api

package
Version: v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2020 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InvalidRequestPayload = "Invalid request payload"
	CreditCardDeleted     = "CreditCard deleted successfully!"
	Success               = "Success"
)
View Source
const (
	InvalidJSON          = "Invalid json provided"
	RestoreBackupSuccess = "Restore from backup completed successfully!"
	ImportSuccess        = "Import finished successfully!"
	BackupSuccess        = "Backup completed successfully!"
)
View Source
const (
	BankAccountDeleteSuccess = "BankAccount deleted successfully!"
)
View Source
const (
	LoginDeleteSuccess = "Login deleted successfully!"
)
View Source
const (
	NoteDeleteSuccess = "Note deleted successfully!"
)
View Source
const (
	ServerDeleteSuccess = "Server deleted successfully!"
)

Variables

View Source
var (
	InvalidUser    = "Invalid user"
	ValidToken     = "Token is valid"
	InvalidToken   = "Token is expired or not valid!"
	NoToken        = "Token could not found! "
	TokenCreateErr = "Token could not be created"
	SignupSuccess  = "User created successfully"
)
View Source
var (
	Port          = "3625"
	ServerAddress = "0.0.0.0" + ":" + Port
)

Functions

func CheckToken

func CheckToken(s storage.Store) http.HandlerFunc

CheckToken ...

func CheckUpdate added in v1.1.1

func CheckUpdate(w http.ResponseWriter, r *http.Request)

GeneratePassword generates new password

func CreateBankAccount added in v1.1.1

func CreateBankAccount(s storage.Store) http.HandlerFunc

Create ...

func CreateCreditCard added in v1.1.1

func CreateCreditCard(s storage.Store) http.HandlerFunc

Create ...

func CreateEmail added in v1.1.1

func CreateEmail(s storage.Store) http.HandlerFunc

CreateEmail ...

func CreateLogin added in v1.1.1

func CreateLogin(s storage.Store) http.HandlerFunc

Create ...

func CreateNote added in v1.1.1

func CreateNote(s storage.Store) http.HandlerFunc

Create ...

func CreateServer added in v1.1.1

func CreateServer(s storage.Store) http.HandlerFunc

CreateServer ...

func CreateUser added in v1.1.1

func CreateUser(s storage.Store) http.HandlerFunc

CreateUser ...

func DeleteBankAccount added in v1.1.1

func DeleteBankAccount(s storage.Store) http.HandlerFunc

DeleteBankAccount ...

func DeleteCreditCard added in v1.1.1

func DeleteCreditCard(s storage.Store) http.HandlerFunc

Delete ...

func DeleteEmail added in v1.1.1

func DeleteEmail(s storage.Store) http.HandlerFunc

DeleteEmail ...

func DeleteLogin added in v1.1.1

func DeleteLogin(s storage.Store) http.HandlerFunc

Delete ...

func DeleteNote added in v1.1.1

func DeleteNote(s storage.Store) http.HandlerFunc

DeleteNote ...

func DeleteServer added in v1.1.1

func DeleteServer(s storage.Store) http.HandlerFunc

DeleteServer ...

func DeleteUser added in v1.1.1

func DeleteUser(s storage.Store) http.HandlerFunc

DeleteUser ...

func FindAllBankAccounts added in v1.1.1

func FindAllBankAccounts(s storage.Store) http.HandlerFunc

FindAll ...

func FindAllCreditCards added in v1.1.1

func FindAllCreditCards(s storage.Store) http.HandlerFunc

FindAll ...

func FindAllEmails added in v1.1.1

func FindAllEmails(s storage.Store) http.HandlerFunc

FindAllEmails ...

func FindAllLogins added in v1.1.1

func FindAllLogins(s storage.Store) http.HandlerFunc

FindAll ...

func FindAllNotes added in v1.1.1

func FindAllNotes(s storage.Store) http.HandlerFunc

FindAll ...

func FindAllServers added in v1.1.1

func FindAllServers(s storage.Store) http.HandlerFunc

FindAllServers ...

func FindAllUsers added in v1.1.1

func FindAllUsers(s storage.Store) http.HandlerFunc

FindAllUsers ...

func FindBankAccountByID added in v1.1.1

func FindBankAccountByID(s storage.Store) http.HandlerFunc

FindByID ...

func FindCreditCardByID added in v1.1.1

func FindCreditCardByID(s storage.Store) http.HandlerFunc

FindByID ...

func FindEmailByID added in v1.1.1

func FindEmailByID(s storage.Store) http.HandlerFunc

FindEmailByID ...

func FindLoginsByID added in v1.1.1

func FindLoginsByID(s storage.Store) http.HandlerFunc

FindByID ...

func FindNoteByID added in v1.1.1

func FindNoteByID(s storage.Store) http.HandlerFunc

FindByID ...

func FindSamePassword added in v1.1.1

func FindSamePassword(s storage.Store) http.HandlerFunc

FindSamePassword ...

func FindServerByID added in v1.1.1

func FindServerByID(s storage.Store) http.HandlerFunc

FindServerByID ...

func FindUserByID added in v1.1.1

func FindUserByID(s storage.Store) http.HandlerFunc

FindUserByID ...

func GeneratePassword added in v1.1.1

func GeneratePassword(w http.ResponseWriter, r *http.Request)

Password generates new password

func GetErrors added in v1.1.1

func GetErrors(errs []validator.FieldError) []string

GetErrors ...

func HealthCheck added in v1.1.1

func HealthCheck(s storage.Store) http.HandlerFunc

HealthCheck ...

func Language added in v1.1.1

func Language(s storage.Store) http.HandlerFunc

Language ...

func Languages added in v1.1.1

func Languages(s storage.Store) http.HandlerFunc

Languages ...

func RefreshToken

func RefreshToken(s storage.Store) http.HandlerFunc

RefreshToken ...

func RespondWithError added in v1.1.1

func RespondWithError(w http.ResponseWriter, code int, message string)

RespondWithError ...

func RespondWithErrors added in v1.1.1

func RespondWithErrors(w http.ResponseWriter, code int, message string, errors []string)

RespondWithErrors ...

func RespondWithJSON added in v1.1.1

func RespondWithJSON(w http.ResponseWriter, code int, payload interface{})

RespondWithJSON write json

func Restore added in v1.1.1

func Restore(s storage.Store) http.HandlerFunc

Restore restores logins from backup file ./store/passwall-{BACKUP_DATE}.bak

func SetArgs

func SetArgs(r *http.Request, fields []string) (map[string]string, map[string]int)

SetArgs ...

func Signin

func Signin(s storage.Store) http.HandlerFunc

Signin ...

func Signup added in v1.1.1

func Signup(s storage.Store) http.HandlerFunc

Signup ...

func ToSnakeCase

func ToSnakeCase(str string) string

ToSnakeCase changes string to database table

func UpdateBankAccount added in v1.1.1

func UpdateBankAccount(s storage.Store) http.HandlerFunc

Update ...

func UpdateCreditCard added in v1.1.1

func UpdateCreditCard(s storage.Store) http.HandlerFunc

Update ...

func UpdateEmail added in v1.1.1

func UpdateEmail(s storage.Store) http.HandlerFunc

UpdateEmail ...

func UpdateLogin added in v1.1.1

func UpdateLogin(s storage.Store) http.HandlerFunc

Update ...

func UpdateNote added in v1.1.1

func UpdateNote(s storage.Store) http.HandlerFunc

Update ...

func UpdateServer added in v1.1.1

func UpdateServer(s storage.Store) http.HandlerFunc

UpdateServer ...

func UpdateUser added in v1.1.1

func UpdateUser(s storage.Store) http.HandlerFunc

UpdateUser ...

Types

type ErrorResponseDTO added in v1.1.1

type ErrorResponseDTO struct {
	Code    int      `json:"code"`
	Status  string   `json:"status"`
	Message string   `json:"message"`
	Errors  []string `json:"errors"`
}

type HealthProp added in v1.1.1

type HealthProp struct {
	StatusCode int   `json:"status_code"`
	Err        error `json:"error"`
}

HealthProp ...

type Services added in v1.1.1

type Services struct {
	API      *HealthProp `json:"api"`
	Database *HealthProp `json:"database"`
}

Services ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL