handlers

package
v0.0.0-...-0f031a4 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthHandler

type AuthHandler struct {
	*openapi.Handler
	// contains filtered or unexported fields
}

func NewAuthHandler

func NewAuthHandler(openapi *openapi.Handler, svc UserService) *AuthHandler

func (*AuthHandler) Register

func (h *AuthHandler) Register(s *server.Server)

type CreatePersonalAccessTokenRequest

type CreatePersonalAccessTokenRequest struct {
	Name      string `json:"name"`
	ExpiresAt string `json:"expires_at"`
}

type CreateTaskRequest

type CreateTaskRequest struct {
	Title string `json:"title"`
}

type GoogleUser

type GoogleUser struct {
	Id            string `json:"id"`
	Email         string `json:"email"`
	VerifiedEmail bool   `json:"verified_email"`
	Picture       string `json:"picture"`
}

type Handler

type Handler interface {
	Register(s *server.Server)
}

type LoginRequest

type LoginRequest struct {
	Email    string `json:"email,omitempty"`
	Password string `json:"password"`
	Username string `json:"username,omitempty"`
}

type LoginResponse

type LoginResponse struct {
	AccessToken  string `json:"access_token"`
	ExpiresIn    int64  `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
	TokenType    string `json:"token_type"`
}

type LogoutRequest

type LogoutRequest struct {
	RefreshToken string `json:"refresh_token"`
}

type MockPersonalAccessTokenService

type MockPersonalAccessTokenService struct {
	mock.Mock
}

MockPersonalAccessTokenService is an autogenerated mock type for the PersonalAccessTokenService type

func NewMockPersonalAccessTokenService

func NewMockPersonalAccessTokenService(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockPersonalAccessTokenService

NewMockPersonalAccessTokenService creates a new instance of MockPersonalAccessTokenService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockPersonalAccessTokenService) Create

Create provides a mock function with given fields: ctx, model

func (*MockPersonalAccessTokenService) EXPECT

func (*MockPersonalAccessTokenService) Find

Find provides a mock function with given fields: ctx, userId

func (*MockPersonalAccessTokenService) FindOne

FindOne provides a mock function with given fields: ctx, userId, name

func (*MockPersonalAccessTokenService) Read

Read provides a mock function with given fields: ctx, userId, id

func (*MockPersonalAccessTokenService) Revoke

Revoke provides a mock function with given fields: ctx, model

type MockPersonalAccessTokenService_Create_Call

type MockPersonalAccessTokenService_Create_Call struct {
	*mock.Call
}

MockPersonalAccessTokenService_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create'

func (*MockPersonalAccessTokenService_Create_Call) Return

func (*MockPersonalAccessTokenService_Create_Call) Run

type MockPersonalAccessTokenService_Expecter

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

func (*MockPersonalAccessTokenService_Expecter) Create

func (_e *MockPersonalAccessTokenService_Expecter) Create(ctx interface{}, model interface{}) *MockPersonalAccessTokenService_Create_Call

Create is a helper method to define mock.On call

  • ctx context.Context
  • model *models.PersonalAccessToken

func (*MockPersonalAccessTokenService_Expecter) Find

func (_e *MockPersonalAccessTokenService_Expecter) Find(ctx interface{}, userId interface{}) *MockPersonalAccessTokenService_Find_Call

Find is a helper method to define mock.On call

  • ctx context.Context
  • userId string

func (*MockPersonalAccessTokenService_Expecter) FindOne

func (_e *MockPersonalAccessTokenService_Expecter) FindOne(ctx interface{}, userId interface{}, name interface{}) *MockPersonalAccessTokenService_FindOne_Call

FindOne is a helper method to define mock.On call

  • ctx context.Context
  • userId string
  • name string

func (*MockPersonalAccessTokenService_Expecter) Read

func (_e *MockPersonalAccessTokenService_Expecter) Read(ctx interface{}, userId interface{}, id interface{}) *MockPersonalAccessTokenService_Read_Call

Read is a helper method to define mock.On call

  • ctx context.Context
  • userId string
  • id string

func (*MockPersonalAccessTokenService_Expecter) Revoke

func (_e *MockPersonalAccessTokenService_Expecter) Revoke(ctx interface{}, model interface{}) *MockPersonalAccessTokenService_Revoke_Call

Revoke is a helper method to define mock.On call

  • ctx context.Context
  • model *models.PersonalAccessToken

type MockPersonalAccessTokenService_FindOne_Call

type MockPersonalAccessTokenService_FindOne_Call struct {
	*mock.Call
}

MockPersonalAccessTokenService_FindOne_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FindOne'

func (*MockPersonalAccessTokenService_FindOne_Call) Return

func (*MockPersonalAccessTokenService_FindOne_Call) Run

func (*MockPersonalAccessTokenService_FindOne_Call) RunAndReturn

type MockPersonalAccessTokenService_Find_Call

type MockPersonalAccessTokenService_Find_Call struct {
	*mock.Call
}

MockPersonalAccessTokenService_Find_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Find'

func (*MockPersonalAccessTokenService_Find_Call) Return

func (*MockPersonalAccessTokenService_Find_Call) Run

func (*MockPersonalAccessTokenService_Find_Call) RunAndReturn

type MockPersonalAccessTokenService_Read_Call

type MockPersonalAccessTokenService_Read_Call struct {
	*mock.Call
}

MockPersonalAccessTokenService_Read_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Read'

func (*MockPersonalAccessTokenService_Read_Call) Return

func (*MockPersonalAccessTokenService_Read_Call) Run

func (*MockPersonalAccessTokenService_Read_Call) RunAndReturn

type MockPersonalAccessTokenService_Revoke_Call

type MockPersonalAccessTokenService_Revoke_Call struct {
	*mock.Call
}

MockPersonalAccessTokenService_Revoke_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Revoke'

func (*MockPersonalAccessTokenService_Revoke_Call) Return

func (*MockPersonalAccessTokenService_Revoke_Call) Run

func (*MockPersonalAccessTokenService_Revoke_Call) RunAndReturn

type MockTaskService

type MockTaskService struct {
	mock.Mock
}

MockTaskService is an autogenerated mock type for the TaskService type

func NewMockTaskService

func NewMockTaskService(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockTaskService

NewMockTaskService creates a new instance of MockTaskService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockTaskService) Create

func (_m *MockTaskService) Create(ctx context.Context, id string, data *models.Task) (*models.Task, error)

Create provides a mock function with given fields: ctx, id, data

func (*MockTaskService) Delete

func (_m *MockTaskService) Delete(ctx context.Context, id string, data *models.Task) error

Delete provides a mock function with given fields: ctx, id, data

func (*MockTaskService) EXPECT

func (*MockTaskService) Find

Find provides a mock function with given fields: ctx, params

func (*MockTaskService) Read

func (_m *MockTaskService) Read(ctx context.Context, id string) (*models.Task, error)

Read provides a mock function with given fields: ctx, id

func (*MockTaskService) Update

func (_m *MockTaskService) Update(ctx context.Context, id string, data *models.Task) (*models.Task, error)

Update provides a mock function with given fields: ctx, id, data

type MockTaskService_Create_Call

type MockTaskService_Create_Call struct {
	*mock.Call
}

MockTaskService_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create'

func (*MockTaskService_Create_Call) Return

func (*MockTaskService_Create_Call) Run

func (*MockTaskService_Create_Call) RunAndReturn

type MockTaskService_Delete_Call

type MockTaskService_Delete_Call struct {
	*mock.Call
}

MockTaskService_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete'

func (*MockTaskService_Delete_Call) Return

func (*MockTaskService_Delete_Call) Run

func (*MockTaskService_Delete_Call) RunAndReturn

type MockTaskService_Expecter

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

func (*MockTaskService_Expecter) Create

func (_e *MockTaskService_Expecter) Create(ctx interface{}, id interface{}, data interface{}) *MockTaskService_Create_Call

Create is a helper method to define mock.On call

  • ctx context.Context
  • id string
  • data *models.Task

func (*MockTaskService_Expecter) Delete

func (_e *MockTaskService_Expecter) Delete(ctx interface{}, id interface{}, data interface{}) *MockTaskService_Delete_Call

Delete is a helper method to define mock.On call

  • ctx context.Context
  • id string
  • data *models.Task

func (*MockTaskService_Expecter) Find

func (_e *MockTaskService_Expecter) Find(ctx interface{}, params interface{}) *MockTaskService_Find_Call

Find is a helper method to define mock.On call

  • ctx context.Context
  • params *models.TaskSearchParams

func (*MockTaskService_Expecter) Read

func (_e *MockTaskService_Expecter) Read(ctx interface{}, id interface{}) *MockTaskService_Read_Call

Read is a helper method to define mock.On call

  • ctx context.Context
  • id string

func (*MockTaskService_Expecter) Update

func (_e *MockTaskService_Expecter) Update(ctx interface{}, id interface{}, data interface{}) *MockTaskService_Update_Call

Update is a helper method to define mock.On call

  • ctx context.Context
  • id string
  • data *models.Task

type MockTaskService_Find_Call

type MockTaskService_Find_Call struct {
	*mock.Call
}

MockTaskService_Find_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Find'

func (*MockTaskService_Find_Call) Return

func (*MockTaskService_Find_Call) Run

func (*MockTaskService_Find_Call) RunAndReturn

type MockTaskService_Read_Call

type MockTaskService_Read_Call struct {
	*mock.Call
}

MockTaskService_Read_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Read'

func (*MockTaskService_Read_Call) Return

func (*MockTaskService_Read_Call) Run

func (*MockTaskService_Read_Call) RunAndReturn

type MockTaskService_Update_Call

type MockTaskService_Update_Call struct {
	*mock.Call
}

MockTaskService_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update'

func (*MockTaskService_Update_Call) Return

func (*MockTaskService_Update_Call) Run

func (*MockTaskService_Update_Call) RunAndReturn

type MockUserService

type MockUserService struct {
	mock.Mock
}

MockUserService is an autogenerated mock type for the UserService type

func NewMockUserService

func NewMockUserService(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockUserService

NewMockUserService creates a new instance of MockUserService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockUserService) Create

func (_m *MockUserService) Create(ctx context.Context, model *models.User) (*models.User, error)

Create provides a mock function with given fields: ctx, model

func (*MockUserService) Delete

func (_m *MockUserService) Delete(ctx context.Context, id string, model *models.User) error

Delete provides a mock function with given fields: ctx, id, model

func (*MockUserService) EXPECT

func (*MockUserService) Find

Find provides a mock function with given fields: ctx, params

func (*MockUserService) FindOneByEmailOrUsername

func (_m *MockUserService) FindOneByEmailOrUsername(ctx context.Context, email string, username string) (*models.User, error)

FindOneByEmailOrUsername provides a mock function with given fields: ctx, email, username

func (*MockUserService) Read

func (_m *MockUserService) Read(ctx context.Context, id string) (*models.User, error)

Read provides a mock function with given fields: ctx, id

func (*MockUserService) Update

func (_m *MockUserService) Update(ctx context.Context, id string, model *models.User) (*models.User, error)

Update provides a mock function with given fields: ctx, id, model

type MockUserService_Create_Call

type MockUserService_Create_Call struct {
	*mock.Call
}

MockUserService_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create'

func (*MockUserService_Create_Call) Return

func (*MockUserService_Create_Call) Run

func (*MockUserService_Create_Call) RunAndReturn

type MockUserService_Delete_Call

type MockUserService_Delete_Call struct {
	*mock.Call
}

MockUserService_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete'

func (*MockUserService_Delete_Call) Return

func (*MockUserService_Delete_Call) Run

func (*MockUserService_Delete_Call) RunAndReturn

type MockUserService_Expecter

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

func (*MockUserService_Expecter) Create

func (_e *MockUserService_Expecter) Create(ctx interface{}, model interface{}) *MockUserService_Create_Call

Create is a helper method to define mock.On call

  • ctx context.Context
  • model *models.User

func (*MockUserService_Expecter) Delete

func (_e *MockUserService_Expecter) Delete(ctx interface{}, id interface{}, model interface{}) *MockUserService_Delete_Call

Delete is a helper method to define mock.On call

  • ctx context.Context
  • id string
  • model *models.User

func (*MockUserService_Expecter) Find

func (_e *MockUserService_Expecter) Find(ctx interface{}, params interface{}) *MockUserService_Find_Call

Find is a helper method to define mock.On call

  • ctx context.Context
  • params *models.UserSearchParams

func (*MockUserService_Expecter) FindOneByEmailOrUsername

func (_e *MockUserService_Expecter) FindOneByEmailOrUsername(ctx interface{}, email interface{}, username interface{}) *MockUserService_FindOneByEmailOrUsername_Call

FindOneByEmailOrUsername is a helper method to define mock.On call

  • ctx context.Context
  • email string
  • username string

func (*MockUserService_Expecter) Read

func (_e *MockUserService_Expecter) Read(ctx interface{}, id interface{}) *MockUserService_Read_Call

Read is a helper method to define mock.On call

  • ctx context.Context
  • id string

func (*MockUserService_Expecter) Update

func (_e *MockUserService_Expecter) Update(ctx interface{}, id interface{}, model interface{}) *MockUserService_Update_Call

Update is a helper method to define mock.On call

  • ctx context.Context
  • id string
  • model *models.User

type MockUserService_FindOneByEmailOrUsername_Call

type MockUserService_FindOneByEmailOrUsername_Call struct {
	*mock.Call
}

MockUserService_FindOneByEmailOrUsername_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FindOneByEmailOrUsername'

func (*MockUserService_FindOneByEmailOrUsername_Call) Return

func (*MockUserService_FindOneByEmailOrUsername_Call) Run

func (*MockUserService_FindOneByEmailOrUsername_Call) RunAndReturn

type MockUserService_Find_Call

type MockUserService_Find_Call struct {
	*mock.Call
}

MockUserService_Find_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Find'

func (*MockUserService_Find_Call) Return

func (*MockUserService_Find_Call) Run

func (*MockUserService_Find_Call) RunAndReturn

type MockUserService_Read_Call

type MockUserService_Read_Call struct {
	*mock.Call
}

MockUserService_Read_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Read'

func (*MockUserService_Read_Call) Return

func (*MockUserService_Read_Call) Run

func (*MockUserService_Read_Call) RunAndReturn

type MockUserService_Update_Call

type MockUserService_Update_Call struct {
	*mock.Call
}

MockUserService_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update'

func (*MockUserService_Update_Call) Return

func (*MockUserService_Update_Call) Run

func (*MockUserService_Update_Call) RunAndReturn

type OAuth2GoogleCallbackResponse

type OAuth2GoogleCallbackResponse struct {
	AccessToken  string `json:"access_token"`
	ExpiresIn    int64  `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
	TokenType    string `json:"token_type"`
}

type PersonalAccessTokenHandler

type PersonalAccessTokenHandler struct {
	*openapi.Handler
	// contains filtered or unexported fields
}

func NewPersonalAccessTokenHandler

func NewPersonalAccessTokenHandler(openapi *openapi.Handler, svc PersonalAccessTokenService) *PersonalAccessTokenHandler

func (*PersonalAccessTokenHandler) Register

func (h *PersonalAccessTokenHandler) Register(s *server.Server)

type PersonalAccessTokenService

type PersonalAccessTokenService interface {
	Create(ctx context.Context, model *models.PersonalAccessToken) (*models.PersonalAccessToken, error)
	Read(ctx context.Context, userId string, id string) (*models.PersonalAccessToken, error)
	Find(ctx context.Context, userId string) (models.PersonalAccessTokens, error)
	FindOne(ctx context.Context, userId string, name string) (*models.PersonalAccessToken, error)
	Revoke(ctx context.Context, model *models.PersonalAccessToken) error
}

type RefreshRequest

type RefreshRequest struct {
	GrantType    string `json:"grant_type"`
	RefreshToken string `json:"refresh_token"`
}

type RefreshResponse

type RefreshResponse struct {
	AccessToken  string `json:"access_token"`
	ExpiresIn    int64  `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
	TokenType    string `json:"token_type"`
}

type RootHandler

type RootHandler struct {
	*openapi.Handler
}

func NewRootHandler

func NewRootHandler(openapi *openapi.Handler) *RootHandler

func (*RootHandler) Register

func (h *RootHandler) Register(s *server.Server)

func (*RootHandler) Root

func (h *RootHandler) Root(c echo.Context) error

Root returns the welcome message.

type SignUpRequest

type SignUpRequest struct {
	Email    string `json:"email"`
	Username string `json:"username"`
	Name     string `json:"name"`
	Bio      string `json:"bio"`
	Password string `json:"password"`
}

type TaskHandler

type TaskHandler struct {
	*openapi.Handler
	// contains filtered or unexported fields
}

func NewTaskHandler

func NewTaskHandler(openapi *openapi.Handler, svc TaskService) *TaskHandler

func (*TaskHandler) Register

func (h *TaskHandler) Register(s *server.Server)

type TaskService

type TaskService interface {
	Create(ctx context.Context, id string, data *models.Task) (*models.Task, error)
	Read(ctx context.Context, id string) (*models.Task, error)
	Update(ctx context.Context, id string, data *models.Task) (*models.Task, error)
	Delete(ctx context.Context, id string, data *models.Task) error
	Find(ctx context.Context, params *models.TaskSearchParams) (int64, models.Tasks, error)
}

type TokenResponse

type TokenResponse struct {
	Exp   time.Time `json:"exp"`
	Iat   time.Time `json:"iat"`
	Iss   string    `json:"iss"`
	Nbf   time.Time `json:"nbf"`
	Roles []string  `json:"roles"`
	Sub   string    `json:"sub"`
	Type  string    `json:"type"`
}

type TransitionTaskRequest

type TransitionTaskRequest struct {
	Completed *bool `json:"completed"`
}

type UpdateCurrentUserRequest

type UpdateCurrentUserRequest struct {
	Name *string `json:"name,omitempty"`
	Bio  *string `json:"bio,omitempty"`
}

type UpdateTaskRequest

type UpdateTaskRequest struct {
	Title *string `json:"title"`
}

type UpdateUserRequest

type UpdateUserRequest struct {
	Name *string `json:"name,omitempty"`
	Bio  *string `json:"bio,omitempty"`
}

type UserHandler

type UserHandler struct {
	*openapi.Handler
	// contains filtered or unexported fields
}

func NewUserHandler

func NewUserHandler(openapi *openapi.Handler, svc UserService) *UserHandler

func (*UserHandler) Register

func (h *UserHandler) Register(s *server.Server)

type UserService

type UserService interface {
	Create(ctx context.Context, model *models.User) (*models.User, error)
	Read(ctx context.Context, id string) (*models.User, error)
	Update(ctx context.Context, id string, model *models.User) (*models.User, error)
	Delete(ctx context.Context, id string, model *models.User) error
	Find(ctx context.Context, params *models.UserSearchParams) (int64, models.Users, error)
	FindOneByEmailOrUsername(ctx context.Context, email string, username string) (*models.User, error)
}

Jump to

Keyboard shortcuts

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