Documentation
¶
Index ¶
- func SHA(str string) string
- type APIRequest
- func (api *APIRequest[T]) Create(data T) (T, error)
- func (api *APIRequest[T]) Delete() (T, error)
- func (api *APIRequest[T]) Get() (T, error)
- func (api *APIRequest[T]) GetAsync() (*fetch.Fetch, error)
- func (api *APIRequest[T]) LoadModel(resp *http.Response) (T, error)
- func (api *APIRequest[T]) Update(data T) (T, error)
- type AuthService
- func (a *AuthService) AuthHeaders(auth *models.Auth) [][]string
- func (a *AuthService) Authenticate(user *models.User) (*models.Auth, error)
- func (a *AuthService) Invalidate(auth *models.Auth) (*models.Auth, error)
- func (a *AuthService) Register(user *models.User) (*models.Auth, error)
- func (a *AuthService) UpdatePassword(pwDTO *models.UpdatePassword, auth *models.Auth) (*models.User, error)
- type GroupService
- func (s *GroupService) Create(auth *models.Auth, data *models.Group) (*models.Group, error)
- func (s *GroupService) Delete(auth *models.Auth, filter *models.Group) (*models.Group, error)
- func (s *GroupService) Get(auth *models.Auth, filter *models.Group) (*models.Group, error)
- func (s *GroupService) GetGroupUsers(auth *models.Auth, filter *models.Group) (*models.GroupUsersDTO, error)
- func (s *GroupService) GetMany(auth *models.Auth) ([]*models.Group, error)
- func (s *GroupService) NewGroupRequest(filter string, auth *models.Auth) *APIRequest[*models.Group]
- func (s *GroupService) NewGroupsRequest(filter string, auth *models.Auth) *APIRequest[*models.Groups]
- func (s *GroupService) Update(auth *models.Auth, data *models.Group) (*models.Group, error)
- type RedisManager
- type Request
- type SessionService
- type TaskService
- func (s *TaskService) Create(auth *models.Auth, data *models.Task) (*models.Task, error)
- func (s *TaskService) Delete(auth *models.Auth, filter *models.Task) (*models.Task, error)
- func (s *TaskService) Get(auth *models.Auth, filter *models.Task) (*models.Task, error)
- func (s *TaskService) GetMany(auth *models.Auth) ([]*models.Task, error)
- func (s *TaskService) NewTaskRequest(filter string, auth *models.Auth) *APIRequest[*models.Task]
- func (s *TaskService) NewTasksRequest(filter string, auth *models.Auth) *APIRequest[*models.Tasks]
- func (s *TaskService) Update(auth *models.Auth, data *models.Task) (*models.Task, error)
- type UserService
- func (s *UserService) Create(auth *models.Auth, data *models.User) (*models.User, error)
- func (s *UserService) Delete(auth *models.Auth, filter *models.User) (*models.User, error)
- func (s *UserService) Get(auth *models.Auth, filter *models.User) (*models.User, error)
- func (s *UserService) GetMany(auth *models.Auth) ([]*models.User, error)
- func (s *UserService) NewUserRequest(filter string, auth *models.Auth) *APIRequest[*models.User]
- func (s *UserService) NewUsersRequest(filter string, auth *models.Auth) *APIRequest[*models.Users]
- func (s *UserService) Update(auth *models.Auth, data *models.User) (*models.User, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type APIRequest ¶
APIRequest is a Generic type struct for organizing dataModel methods
func (*APIRequest[T]) Create ¶
func (api *APIRequest[T]) Create(data T) (T, error)
Create a dataModel
func (*APIRequest[T]) GetAsync ¶
func (api *APIRequest[T]) GetAsync() (*fetch.Fetch, error)
GetAsync a dataModel
func (*APIRequest[T]) LoadModel ¶
func (api *APIRequest[T]) LoadModel(resp *http.Response) (T, error)
LoadModel loads returned json data into a dataModel
func (*APIRequest[T]) Update ¶
func (api *APIRequest[T]) Update(data T) (T, error)
Update a dataModel
type AuthService ¶
type AuthService struct {
// contains filtered or unexported fields
}
AuthService manages the authentication system of the app
func NewAuthService ¶
func NewAuthService() *AuthService
NewAuthService initializes a new AuthService
func (*AuthService) AuthHeaders ¶
func (a *AuthService) AuthHeaders(auth *models.Auth) [][]string
AuthHeaders returns authenticated headers
func (*AuthService) Authenticate ¶
Authenticate a User
func (*AuthService) Invalidate ¶
Invalidate a User session
func (*AuthService) UpdatePassword ¶
func (a *AuthService) UpdatePassword(pwDTO *models.UpdatePassword, auth *models.Auth) (*models.User, error)
UpdatePassword a User's password
type GroupService ¶
type GroupService struct {
// contains filtered or unexported fields
}
GroupService is a Generic type struct for organizing dataModel methods
func NewGroupService ¶
func NewGroupService() *GroupService
NewGroupService initializes and returns a new APIHandler
func (*GroupService) GetGroupUsers ¶
func (s *GroupService) GetGroupUsers(auth *models.Auth, filter *models.Group) (*models.GroupUsersDTO, error)
GetGroupUsers returns a models.GroupUsersDTO struct dataModel
func (*GroupService) NewGroupRequest ¶
func (s *GroupService) NewGroupRequest(filter string, auth *models.Auth) *APIRequest[*models.Group]
NewGroupRequest ...
func (*GroupService) NewGroupsRequest ¶
func (s *GroupService) NewGroupsRequest(filter string, auth *models.Auth) *APIRequest[*models.Groups]
NewGroupsRequest ...
type RedisManager ¶
RedisManager is used for managing the web app's user sessions and state
func InitRedisClient ¶
func InitRedisClient() *RedisManager
InitRedisClient initializes a redis manager struct for session management
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request managers an async request to the API to return data model(s)
func NewRequest ¶
NewRequest initializes and returns a new Request struct
type SessionService ¶
type SessionService struct {
RedisManager *RedisManager
}
SessionService is a struct wrapper around an initialized RedisManager
func NewSessionService ¶
func NewSessionService() *SessionService
NewSessionService initializes a Session Manager
func (*SessionService) DeleteSession ¶
func (m *SessionService) DeleteSession(cookie *http.Cookie) error
DeleteSession deletes a user session
func (*SessionService) GetSession ¶
GetSession returns a user Auth session
func (*SessionService) IsLoggedIn ¶
func (m *SessionService) IsLoggedIn(r *http.Request) bool
IsLoggedIn checks if a user making a request is logged in
func (*SessionService) NewSession ¶
NewSession initializes a new user session based on an Auth instance
type TaskService ¶
type TaskService struct {
// contains filtered or unexported fields
}
TaskService is a Generic type struct for organizing dataModel methods
func NewTaskService ¶
func NewTaskService() *TaskService
NewTaskService initializes and returns a new APIHandler
func (*TaskService) NewTaskRequest ¶
func (s *TaskService) NewTaskRequest(filter string, auth *models.Auth) *APIRequest[*models.Task]
NewTaskRequest ...
func (*TaskService) NewTasksRequest ¶
func (s *TaskService) NewTasksRequest(filter string, auth *models.Auth) *APIRequest[*models.Tasks]
NewTasksRequest ...
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
UserService is a Generic type struct for organizing dataModel methods
func NewUserService ¶
func NewUserService() *UserService
NewUserService initializes and returns a new APIHandler
func (*UserService) NewUserRequest ¶
func (s *UserService) NewUserRequest(filter string, auth *models.Auth) *APIRequest[*models.User]
NewUserRequest ... filter string,
func (*UserService) NewUsersRequest ¶
func (s *UserService) NewUsersRequest(filter string, auth *models.Auth) *APIRequest[*models.Users]
NewUsersRequest ... where filter = "/" + filter.GetID() or just ""