authorizer/server/db/providers/providers.go

65 lines
3.4 KiB
Go
Raw Normal View History

2022-01-21 06:48:07 +00:00
package providers
import (
2022-07-10 16:19:33 +00:00
"context"
"github.com/authorizerdev/authorizer/server/db/models"
"github.com/authorizerdev/authorizer/server/graph/model"
)
2022-01-21 06:48:07 +00:00
type Provider interface {
// AddUser to save user information in database
2022-07-10 16:19:33 +00:00
AddUser(ctx context.Context, user models.User) (models.User, error)
2022-01-21 06:48:07 +00:00
// UpdateUser to update user information in database
2022-07-10 16:19:33 +00:00
UpdateUser(ctx context.Context, user models.User) (models.User, error)
2022-01-21 06:48:07 +00:00
// DeleteUser to delete user information from database
2022-07-10 16:19:33 +00:00
DeleteUser(ctx context.Context, user models.User) error
2022-01-21 06:48:07 +00:00
// ListUsers to get list of users from database
2022-07-10 16:19:33 +00:00
ListUsers(ctx context.Context, pagination model.Pagination) (*model.Users, error)
2022-01-21 06:48:07 +00:00
// GetUserByEmail to get user information from database using email address
2022-07-10 16:19:33 +00:00
GetUserByEmail(ctx context.Context, email string) (models.User, error)
2022-01-21 06:48:07 +00:00
// GetUserByID to get user information from database using user ID
2022-07-10 16:19:33 +00:00
GetUserByID(ctx context.Context, id string) (models.User, error)
2022-01-21 06:48:07 +00:00
// AddVerification to save verification request in database
2022-07-10 16:19:33 +00:00
AddVerificationRequest(ctx context.Context, verificationRequest models.VerificationRequest) (models.VerificationRequest, error)
2022-01-21 06:48:07 +00:00
// GetVerificationRequestByToken to get verification request from database using token
2022-07-10 16:19:33 +00:00
GetVerificationRequestByToken(ctx context.Context, token string) (models.VerificationRequest, error)
2022-01-21 06:48:07 +00:00
// GetVerificationRequestByEmail to get verification request by email from database
2022-07-10 16:19:33 +00:00
GetVerificationRequestByEmail(ctx context.Context, email string, identifier string) (models.VerificationRequest, error)
2022-01-21 06:48:07 +00:00
// ListVerificationRequests to get list of verification requests from database
2022-07-10 16:19:33 +00:00
ListVerificationRequests(ctx context.Context, pagination model.Pagination) (*model.VerificationRequests, error)
2022-01-21 06:48:07 +00:00
// DeleteVerificationRequest to delete verification request from database
2022-07-10 16:19:33 +00:00
DeleteVerificationRequest(ctx context.Context, verificationRequest models.VerificationRequest) error
2022-01-21 06:48:07 +00:00
// AddSession to save session information in database
2022-07-10 16:19:33 +00:00
AddSession(ctx context.Context, session models.Session) error
2022-01-21 06:48:07 +00:00
// DeleteSession to delete session information from database
2022-07-10 16:19:33 +00:00
DeleteSession(ctx context.Context, userId string) error
2022-01-21 06:48:07 +00:00
// AddEnv to save environment information in database
2022-07-10 16:19:33 +00:00
AddEnv(ctx context.Context, env models.Env) (models.Env, error)
2022-01-21 06:48:07 +00:00
// UpdateEnv to update environment information in database
2022-07-10 16:19:33 +00:00
UpdateEnv(ctx context.Context, env models.Env) (models.Env, error)
2022-01-21 06:48:07 +00:00
// GetEnv to get environment information from database
2022-07-10 16:19:33 +00:00
GetEnv(ctx context.Context) (models.Env, error)
// AddWebhook to add webhook
2022-07-10 16:19:33 +00:00
AddWebhook(ctx context.Context, webhook models.Webhook) (*model.Webhook, error)
// UpdateWebhook to update webhook
2022-07-10 16:19:33 +00:00
UpdateWebhook(ctx context.Context, webhook models.Webhook) (*model.Webhook, error)
// ListWebhooks to list webhook
2022-07-10 16:19:33 +00:00
ListWebhook(ctx context.Context, pagination model.Pagination) (*model.Webhooks, error)
// GetWebhookByID to get webhook by id
2022-07-10 16:19:33 +00:00
GetWebhookByID(ctx context.Context, webhookID string) (*model.Webhook, error)
// GetWebhookByEventName to get webhook by event_name
2022-07-10 16:19:33 +00:00
GetWebhookByEventName(ctx context.Context, eventName string) (*model.Webhook, error)
// DeleteWebhook to delete webhook
2022-07-10 16:19:33 +00:00
DeleteWebhook(ctx context.Context, webhook *model.Webhook) error
// AddWebhookLog to add webhook log
2022-07-10 16:19:33 +00:00
AddWebhookLog(ctx context.Context, webhookLog models.WebhookLog) (*model.WebhookLog, error)
// ListWebhookLogs to list webhook logs
2022-07-10 16:19:33 +00:00
ListWebhookLogs(ctx context.Context, pagination model.Pagination, webhookID string) (*model.WebhookLogs, error)
2022-01-21 06:48:07 +00:00
}