api

package
v0.0.0-...-964291d Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewApi

func NewApi(cfg utils.Config, mux *http.ServeMux, domain domain.Domain, logger *slog.Logger) *jsonApi

Types

type Api

type Api interface {
	Mount(point string)
}

type DeleteAccountRequest

type DeleteAccountRequest struct {
	Email    string `json:"email"`
	Username string `json:"username"`
	Password string `json:"password"`
}

type DeleteAccountResponse

type DeleteAccountResponse struct {
	Success bool `json:"success"`
}

type Error

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

func NewApiError

func NewApiError(message string, cause error, code int) Error

func (Error) Error

func (e Error) Error() string

func (Error) Unwrap

func (e Error) Unwrap() error

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error"`
}

type ForgetPasswordRequest

type ForgetPasswordRequest struct {
	Email    string `json:"email"`
	Username string `json:"username"`
}

type ForgetPasswordResponse

type ForgetPasswordResponse struct {
	Success bool   `json:"success"`
	Email   string `json:"email"`
}

type LogInRequest

type LogInRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
	Email    string `json:"email"`
}

type LogInResponse

type LogInResponse struct {
	ID       uint64 `json:"id"`
	Username string `json:"username"`
	Role     string `json:"role"`
	Email    string `json:"email"`
	Verified bool   `json:"verified"`
}

type SessionResponse

type SessionResponse struct {
	ID       uint64 `json:"id"`
	Username string `json:"username"`
	Role     string `json:"role"`
	Email    string `json:"email"`
	Verified bool   `json:"verified"`
}

type SignUpRequest

type SignUpRequest struct {
	Username string         `json:"username"`
	Password string         `json:"password"`
	Email    string         `json:"email"`
	Role     string         `json:"role"`
	Payload  map[string]any `json:"payload"`
}

type SignUpResponse

type SignUpResponse struct {
	ID       uint64         `json:"id"`
	Username string         `json:"username"`
	Email    string         `json:"email"`
	Role     string         `json:"role"`
	Payload  map[string]any `json:"payload"`
}

type VerifyAccountRequest

type VerifyAccountRequest struct {
	Token string `json:"token"`
}

type VerifyAccountResponse

type VerifyAccountResponse struct {
	Verified bool `json:"verified"`
}

type VerifyPasswordResetRequest

type VerifyPasswordResetRequest struct {
	Token       string `json:"token"`
	NewPassword string `json:"new_password"`
}

type VerifyPasswordResetResponse

type VerifyPasswordResetResponse struct {
	Success bool `json:"success"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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