api

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2020 License: AGPL-3.0 Imports: 19 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"
	VerifySuccess  = "Email verified succesfully"
)
View Source
var (
	Port          = "3625"
	ServerAddress = "0.0.0.0" + ":" + Port
)

Functions

func CheckToken

func CheckToken(s storage.Store) http.HandlerFunc

CheckToken ...

func CheckUpdate

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

GeneratePassword generates new password

func Confirm

func Confirm(s storage.Store) http.HandlerFunc

Confirm ...

func CreateBankAccount

func CreateBankAccount(s storage.Store) http.HandlerFunc

Create ...

func CreateCreditCard

func CreateCreditCard(s storage.Store) http.HandlerFunc

Create ...

func CreateEmail

func CreateEmail(s storage.Store) http.HandlerFunc

CreateEmail ...

func CreateLogin

func CreateLogin(s storage.Store) http.HandlerFunc

Create ...

func CreateNote

func CreateNote(s storage.Store) http.HandlerFunc

Create ...

func CreateServer

func CreateServer(s storage.Store) http.HandlerFunc

CreateServer ...

func CreateUser

func CreateUser(s storage.Store) http.HandlerFunc

CreateUser ...

func DeleteBankAccount

func DeleteBankAccount(s storage.Store) http.HandlerFunc

DeleteBankAccount ...

func DeleteCreditCard

func DeleteCreditCard(s storage.Store) http.HandlerFunc

Delete ...

func DeleteEmail

func DeleteEmail(s storage.Store) http.HandlerFunc

DeleteEmail ...

func DeleteLogin

func DeleteLogin(s storage.Store) http.HandlerFunc

Delete ...

func DeleteNote

func DeleteNote(s storage.Store) http.HandlerFunc

DeleteNote ...

func DeleteServer

func DeleteServer(s storage.Store) http.HandlerFunc

DeleteServer ...

func DeleteUser

func DeleteUser(s storage.Store) http.HandlerFunc

DeleteUser ...

func FindAllBankAccounts

func FindAllBankAccounts(s storage.Store) http.HandlerFunc

FindAll ...

func FindAllCreditCards

func FindAllCreditCards(s storage.Store) http.HandlerFunc

FindAll ...

func FindAllEmails

func FindAllEmails(s storage.Store) http.HandlerFunc

FindAllEmails ...

func FindAllLogins

func FindAllLogins(s storage.Store) http.HandlerFunc

FindAllLogins ...

func FindAllNotes

func FindAllNotes(s storage.Store) http.HandlerFunc

FindAll ...

func FindAllServers

func FindAllServers(s storage.Store) http.HandlerFunc

FindAllServers ...

func FindAllUsers

func FindAllUsers(s storage.Store) http.HandlerFunc

FindAllUsers ...

func FindBankAccountByID

func FindBankAccountByID(s storage.Store) http.HandlerFunc

FindByID ...

func FindCreditCardByID

func FindCreditCardByID(s storage.Store) http.HandlerFunc

FindByID ...

func FindEmailByID

func FindEmailByID(s storage.Store) http.HandlerFunc

FindEmailByID ...

func FindLoginsByID

func FindLoginsByID(s storage.Store) http.HandlerFunc

FindLoginsByID ...

func FindNoteByID

func FindNoteByID(s storage.Store) http.HandlerFunc

FindByID ...

func FindServerByID

func FindServerByID(s storage.Store) http.HandlerFunc

FindServerByID ...

func FindUserByID

func FindUserByID(s storage.Store) http.HandlerFunc

FindUserByID ...

func GeneratePassword

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

Password generates new password

func GetErrors

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

GetErrors ...

func HealthCheck

func HealthCheck(s storage.Store) http.HandlerFunc

HealthCheck ...

func Import

func Import(s storage.Store) http.HandlerFunc

Create ...

func Language

func Language(s storage.Store) http.HandlerFunc

Language ...

func Languages

func Languages(s storage.Store) http.HandlerFunc

Languages ...

func RefreshToken

func RefreshToken(s storage.Store) http.HandlerFunc

RefreshToken ...

func RespondWithError

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

RespondWithError ...

func RespondWithErrors

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

RespondWithErrors ...

func RespondWithJSON

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

RespondWithJSON write json

func Restore

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

func Signup(s storage.Store) http.HandlerFunc

Signup ...

func TestLogin

func TestLogin(s storage.Store) http.HandlerFunc

Test endpoint ...

func ToPayload

func ToPayload(r *http.Request) (model.Payload, error)

ToPayload unmarshal request body to payload

func ToSnakeCase

func ToSnakeCase(str string) string

ToSnakeCase changes string to database table

func UpdateBankAccount

func UpdateBankAccount(s storage.Store) http.HandlerFunc

Update ...

func UpdateCreditCard

func UpdateCreditCard(s storage.Store) http.HandlerFunc

Update ...

func UpdateEmail

func UpdateEmail(s storage.Store) http.HandlerFunc

UpdateEmail ...

func UpdateLogin

func UpdateLogin(s storage.Store) http.HandlerFunc

Update ...

func UpdateNote

func UpdateNote(s storage.Store) http.HandlerFunc

Update ...

func UpdateServer

func UpdateServer(s storage.Store) http.HandlerFunc

UpdateServer ...

func UpdateUser

func UpdateUser(s storage.Store) http.HandlerFunc

UpdateUser ...

Types

type ErrorResponseDTO

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

type HealthProp

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

HealthProp ...

type Services

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
y or Y : Canonical URL