presenter

package
v0.0.0-...-fd201ba Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthChallenge

type AuthChallenge struct {
	Type   string `json:"type,omitempty" example:"Basic"`
	Status string `json:"status,omitempty" example:"ACTIVE"`
}

func PrepareAuthChallenge

func PrepareAuthChallenge(authChallenges []domain.AuthChallenge) []AuthChallenge

type Authorize

type Authorize struct {
	Authorized bool   `json:"authorized"`
	JTI        string `json:"jti"`
	EXP        int64  `json:"exp"`
	ID         uint64 `json:"id"`
}

type Error

type Error struct {
	Error string `json:"error" example:"error message"`
}

type Permission

type Permission struct {
	ID          string  `json:"id,omitempty" example:"8f4a1582-6a67-4d85-950b-2d17049c7385"`
	Title       *string `json:"title,omitempty" example:"Admin"`
	Group       *string `json:"group,omitempty" example:"user_role"`
	Description *string `json:"description,omitempty" example:"Admin description"`
}

func PreparePermission

func PreparePermission(permission *domain.Permission) *Permission

func ToPermissionCollection

func ToPermissionCollection(permissions []*domain.Permission) []Permission

type Response

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

func NewResponse

func NewResponse(
	ctx *gin.Context,
	trans translation.Translator,
	statusCodeMappings ...map[serviceerror.ErrorMessage]int,
) *Response

func (*Response) Echo

func (r *Response) Echo(overrideStatusCodes ...int)

func (*Response) Error

func (r *Response) Error(err error) *Response

func (*Response) ErrorMsg

func (r *Response) ErrorMsg(err error) *Response

func (*Response) GetResponse

func (r *Response) GetResponse() map[string]interface{}

func (*Response) GetServiceError

func (r *Response) GetServiceError() serviceerror.Error

func (*Response) GetStatusCodeMapping

func (r *Response) GetStatusCodeMapping() map[serviceerror.ErrorMessage]int

func (*Response) InvalidRequest

func (r *Response) InvalidRequest(err error) *Response

func (*Response) Message

func (r *Response) Message(msg string) *Response

func (*Response) Meta

func (r *Response) Meta(data interface{}) *Response

func (*Response) Payload

func (r *Response) Payload(data interface{}) *Response

func (*Response) Validation

func (r *Response) Validation(err error) *Response

type Role

type Role struct {
	ID          string       `json:"id" example:"8f4a1582-6a67-4d85-950b-2d17049c7385"`
	Title       string       `json:"title" example:"Admin"`
	Description string       `json:"description,omitempty" example:"Admin description"`
	IsDefault   bool         `json:"isDefault,omitempty" example:"true"`
	Permissions []Permission `json:"permissions,omitempty"`
}

func PrepareRole

func PrepareRole(role *domain.Role) *Role

func ToRoleCollection

func ToRoleCollection(roles []*domain.Role) []Role

func ToRoleResource

func ToRoleResource(role *domain.Role) *Role

type TOTPKey

type TOTPKey struct {
	Secret string `json:"secret" example:"secret"`
	URL    string `json:"url" example:"otpauth_url"`
}

func ToTOTPResource

func ToTOTPResource(totp *domain.TOTPKey) *TOTPKey

type Token

type Token struct {
	AccessToken *string `json:"accessToken,omitempty" example:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"`
}

func ToTokenResource

func ToTokenResource(token *string) *Token

type User

type User struct {
	ID             string          `json:"id,omitempty" example:"8f4a1582-6a67-4d85-950b-2d17049c7385"`
	FirstName      *string         `json:"firstName,omitempty" example:"john"`
	LastName       *string         `json:"lastName,omitempty" example:"doe"`
	Email          string          `json:"email,omitempty" example:"john.doe@gmail.com"`
	Status         string          `json:"status,omitempty" example:"ACTIVE"`
	Gender         *string         `json:"gender,omitempty" example:"MALE"`
	AuthChallenges []AuthChallenge `json:"authChallenges"`
}

func PrepareUser

func PrepareUser(user *domain.User) *User

func ToUserCollection

func ToUserCollection(users []*domain.User) []User

func ToUserResource

func ToUserResource(user *domain.User) *User

type ValidationError

type ValidationError struct {
	Field   string `json:"field" example:"email"`
	Message string `json:"message" example:"The email must be a valid email address."`
}

func Translate

func Translate(trans translation.Translator, err error) (validationErrors []ValidationError)

Jump to

Keyboard shortcuts

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