api

package
v1.2.27 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2025 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrForbidden = &apimodels.UnexpectedErrorStatusCode{
	StatusCode: http.StatusForbidden,
	Response:   apimodels.UnexpectedError{Error: "Forbidden"},
}
View Source
var ErrInternalServerError = &apimodels.UnexpectedErrorStatusCode{
	StatusCode: http.StatusInternalServerError,
	Response:   apimodels.UnexpectedError{Error: "internal server error"},
}
View Source
var ErrUnauthorized = &apimodels.UnexpectedErrorStatusCode{
	StatusCode: http.StatusUnauthorized,
	Response:   apimodels.UnexpectedError{Error: "Unauthorized"},
}

Functions

This section is empty.

Types

type API

type API struct {
	apimodels.UnimplementedHandler

	LoginService               LoginService
	LoginAnonService           LoginAnonService
	ConsumeRefreshTokenService ConsumeRefreshTokenService

	RequestEmailUpdateService   RequestEmailUpdateService
	RequestPasswordResetService RequestPasswordResetService
	RequestRegisterService      RequestRegisterService

	RegisterService       RegisterService
	EmailExistsService    EmailExistsService
	UpdateEmailService    UpdateEmailService
	UpdatePasswordService UpdatePasswordService
	UpdateRoleService     UpdateRoleService

	ListUsersService ListUsersService
	GetUserService   GetUserService

	JKClient   *jkApiModels.Client
	SMTPClient smtp.Sender
}

func (*API) CheckSession

func (api *API) CheckSession(ctx context.Context) (apimodels.CheckSessionRes, error)

func (*API) CreateAnonSession

func (api *API) CreateAnonSession(ctx context.Context) (apimodels.CreateAnonSessionRes, error)

func (*API) CreateSession

func (api *API) CreateSession(ctx context.Context, req *apimodels.LoginForm) (apimodels.CreateSessionRes, error)

func (*API) CredentialsRoleFromModel

func (api *API) CredentialsRoleFromModel(role models.CredentialsRole) apimodels.CredentialsRole

func (*API) CredentialsRoleToModel

func (api *API) CredentialsRoleToModel(role apimodels.CredentialsRole) models.CredentialsRole

func (*API) EmailExists

func (api *API) EmailExists(ctx context.Context, params apimodels.EmailExistsParams) (apimodels.EmailExistsRes, error)

func (*API) GetUser

func (api *API) GetUser(
	ctx context.Context, params apimodels.GetUserParams,
) (apimodels.GetUserRes, error)

func (*API) Healthcheck

func (api *API) Healthcheck(ctx context.Context) (apimodels.HealthcheckRes, error)

func (*API) ListUsers

func (api *API) ListUsers(ctx context.Context, params apimodels.ListUsersParams) (apimodels.ListUsersRes, error)

func (*API) NewError

func (api *API) NewError(ctx context.Context, err error) *apimodels.UnexpectedErrorStatusCode

func (*API) Ping

func (api *API) Ping(_ context.Context) (apimodels.PingRes, error)

func (*API) RefreshSession

func (api *API) RefreshSession(
	ctx context.Context, params apimodels.RefreshSessionParams,
) (apimodels.RefreshSessionRes, error)

func (*API) Register

func (api *API) Register(ctx context.Context, req *apimodels.RegisterForm) (apimodels.RegisterRes, error)

func (*API) RequestEmailUpdate

func (api *API) RequestEmailUpdate(
	ctx context.Context, req *apimodels.RequestEmailUpdateForm,
) (apimodels.RequestEmailUpdateRes, error)

func (*API) RequestPasswordReset

func (api *API) RequestPasswordReset(
	ctx context.Context, req *apimodels.RequestPasswordResetForm,
) (apimodels.RequestPasswordResetRes, error)

func (*API) RequestRegistration

func (api *API) RequestRegistration(
	ctx context.Context, req *apimodels.RequestRegistrationForm,
) (apimodels.RequestRegistrationRes, error)

func (*API) ResetPassword

func (api *API) ResetPassword(
	ctx context.Context, req *apimodels.ResetPasswordForm,
) (apimodels.ResetPasswordRes, error)

func (*API) UpdateEmail

func (api *API) UpdateEmail(ctx context.Context, req *apimodels.UpdateEmailForm) (apimodels.UpdateEmailRes, error)

func (*API) UpdatePassword

func (api *API) UpdatePassword(
	ctx context.Context, req *apimodels.UpdatePasswordForm) (apimodels.UpdatePasswordRes, error,
)

func (*API) UpdateRole

func (api *API) UpdateRole(ctx context.Context, req *apimodels.UpdateRoleForm) (apimodels.UpdateRoleRes, error)

type ConsumeRefreshTokenService

type ConsumeRefreshTokenService interface {
	ConsumeRefreshToken(ctx context.Context, request services.ConsumeRefreshTokenRequest) (string, error)
}

type EmailExistsService

type EmailExistsService interface {
	EmailExists(ctx context.Context, request services.EmailExistsRequest) (bool, error)
}

type GetUserService

type GetUserService interface {
	SelectUser(ctx context.Context, request services.SelectUserRequest) (*models.User, error)
}

type ListUsersService

type ListUsersService interface {
	ListUsers(ctx context.Context, request services.ListUsersRequest) ([]*models.User, error)
}

type LoginAnonService

type LoginAnonService interface {
	LoginAnon(ctx context.Context) (string, error)
}

type LoginService

type LoginService interface {
	Login(ctx context.Context, request services.LoginRequest) (*models.Token, error)
}

type RegisterService

type RegisterService interface {
	Register(ctx context.Context, request services.RegisterRequest) (*models.Token, error)
}

type RequestEmailUpdateService

type RequestEmailUpdateService interface {
	RequestEmailUpdate(ctx context.Context, request services.RequestEmailUpdateRequest) (*models.ShortCode, error)
}

type RequestPasswordResetService

type RequestPasswordResetService interface {
	RequestPasswordReset(ctx context.Context, request services.RequestPasswordResetRequest) (*models.ShortCode, error)
}

type RequestRegisterService

type RequestRegisterService interface {
	RequestRegister(ctx context.Context, request services.RequestRegisterRequest) (*models.ShortCode, error)
}

type SecurityHandler

type SecurityHandler struct {
	// contains filtered or unexported fields
}

func NewSecurity

func NewSecurity(
	source pkg.AuthenticateSource, permissions config.Permissions,
) (*SecurityHandler, error)

func (*SecurityHandler) HandleBearerAuth

func (security *SecurityHandler) HandleBearerAuth(
	ctx context.Context, operationName apimodels.OperationName, auth apimodels.BearerAuth,
) (context.Context, error)

type UpdateEmailService

type UpdateEmailService interface {
	UpdateEmail(ctx context.Context, request services.UpdateEmailRequest) (*services.UpdateEmailResponse, error)
}

type UpdatePasswordService

type UpdatePasswordService interface {
	UpdatePassword(ctx context.Context, request services.UpdatePasswordRequest) error
}

type UpdateRoleService

type UpdateRoleService interface {
	UpdateRole(ctx context.Context, request services.UpdateRoleRequest) (*models.User, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL