api

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2022 License: AGPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// InvalidRequestPayload represents invalid request payload messaage
	InvalidRequestPayload = "Invalid request payload"
	// CreditCardDeleted represents message when deleting credit cart successfully
	CreditCardDeleted = "CreditCard deleted successfully!"
	// Success represent success message
	Success = "Success"
)
View Source
const (
	//InvalidJSON represents a message for invalid json
	InvalidJSON = "Invalid json provided"
	//RestoreBackupSuccess represents a message when restoring from backap successfully
	RestoreBackupSuccess = "Restore from backup completed successfully!"
	//ImportSuccess represents when inporting successgully
	ImportSuccess = "Import finished successfully!"
	//BackupSuccess represents when backup completed successfully
	BackupSuccess = "Backup completed successfully!"
)
View Source
const (
	//ServerDeleteSuccess represents message when deleting server successfully
	ServerDeleteSuccess = "Server deleted successfully!"
)
View Source
const (
	//SubscriptionDeleteSuccess represents message when deletind subscription successfully
	SubscriptionDeleteSuccess = "Subscription deleted successfully!"
)

Variables

View Source
var (
	//Port representd a server port
	Port = "3625"
	//ServerAddress represents a server addres
	ServerAddress = "0.0.0.0" + ":" + Port
)

Functions

func BulkUpdateBankAccounts added in v1.2.1

func BulkUpdateBankAccounts(s storage.Store) http.HandlerFunc

BulkUpdateBankAccounts updates bankAccounts in payload

func BulkUpdateCreditCards added in v1.2.1

func BulkUpdateCreditCards(s storage.Store) http.HandlerFunc

BulkUpdateCreditCards updates creditCards in payload

func BulkUpdateEmails added in v1.2.1

func BulkUpdateEmails(s storage.Store) http.HandlerFunc

BulkUpdateEmails updates emails in payload

func BulkUpdateLogins added in v1.2.1

func BulkUpdateLogins(s storage.Store) http.HandlerFunc

BulkUpdateLogins updates logins in payload

func BulkUpdateNotes added in v1.2.1

func BulkUpdateNotes(s storage.Store) http.HandlerFunc

BulkUpdateNotes updates notes in payload

func BulkUpdateServers added in v1.2.1

func BulkUpdateServers(s storage.Store) http.HandlerFunc

BulkUpdateServers updates servers in payload

func ChangeMasterPassword added in v1.2.1

func ChangeMasterPassword(s storage.Store) http.HandlerFunc

UpdateUser ...

func CheckCredentials added in v1.2.1

func CheckCredentials(s storage.Store) http.HandlerFunc

CheckCredentials ...

func CheckToken

func CheckToken(s storage.Store) http.HandlerFunc

CheckToken ...

func CheckUpdate

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

CheckUpdate generates new password

func CreateBankAccount

func CreateBankAccount(s storage.Store) http.HandlerFunc

CreateBankAccount creates a bank aaccount

func CreateCode added in v1.1.7

func CreateCode(s storage.Store) http.HandlerFunc

Create email verification code

func CreateCreditCard

func CreateCreditCard(s storage.Store) http.HandlerFunc

CreateCreditCard creates a credit cart

func CreateDeleteCode added in v1.2.1

func CreateDeleteCode(s storage.Store) http.HandlerFunc

Create user deletion code

func CreateEmail

func CreateEmail(s storage.Store) http.HandlerFunc

CreateEmail ...

func CreateLogin

func CreateLogin(s storage.Store) http.HandlerFunc

CreateLogin creates a login

func CreateNote

func CreateNote(s storage.Store) http.HandlerFunc

CreateNote creates a note

func CreateServer

func CreateServer(s storage.Store) http.HandlerFunc

CreateServer ...

func CreateSubscription added in v1.1.3

func CreateSubscription(s storage.Store) http.HandlerFunc

CreateSubscription ...

func CreateUser

func CreateUser(s storage.Store) http.HandlerFunc

CreateUser ...

func DeleteBankAccount

func DeleteBankAccount(s storage.Store) http.HandlerFunc

DeleteBankAccount deletes a bank account

func DeleteCreditCard

func DeleteCreditCard(s storage.Store) http.HandlerFunc

DeleteCreditCard deletes a credit cart

func DeleteEmail

func DeleteEmail(s storage.Store) http.HandlerFunc

DeleteEmail ...

func DeleteLogin

func DeleteLogin(s storage.Store) http.HandlerFunc

DeleteLogin deletes a login

func DeleteNote

func DeleteNote(s storage.Store) http.HandlerFunc

DeleteNote deletes a note

func DeleteServer

func DeleteServer(s storage.Store) http.HandlerFunc

DeleteServer ...

func DeleteSubscription added in v1.1.3

func DeleteSubscription(s storage.Store) http.HandlerFunc

DeleteSubscription ...

func DeleteUser

func DeleteUser(s storage.Store) http.HandlerFunc

DeleteUser ...

func Export added in v1.2.1

func Export(s storage.Store) http.HandlerFunc

Export exports all data as CSV file

func FindAllBankAccounts

func FindAllBankAccounts(s storage.Store) http.HandlerFunc

FindAllBankAccounts finds all bank accounts

func FindAllCreditCards

func FindAllCreditCards(s storage.Store) http.HandlerFunc

FindAllCreditCards finds all credid carts

func FindAllEmails

func FindAllEmails(s storage.Store) http.HandlerFunc

FindAllEmails ...

func FindAllLogins

func FindAllLogins(s storage.Store) http.HandlerFunc

FindAllLogins finds all logins

func FindAllNotes

func FindAllNotes(s storage.Store) http.HandlerFunc

FindAllNotes finds all notes

func FindAllServers

func FindAllServers(s storage.Store) http.HandlerFunc

FindAllServers ...

func FindAllSubscriptions added in v1.1.3

func FindAllSubscriptions(s storage.Store) http.HandlerFunc

FindAllSubscriptions ...

func FindAllUsers

func FindAllUsers(s storage.Store) http.HandlerFunc

FindAllUsers ...

func FindBankAccountByID

func FindBankAccountByID(s storage.Store) http.HandlerFunc

FindBankAccountByID finds a bank account by id

func FindCreditCardByID

func FindCreditCardByID(s storage.Store) http.HandlerFunc

FindCreditCardByID finds a credit cart by id

func FindEmailByID

func FindEmailByID(s storage.Store) http.HandlerFunc

FindEmailByID ...

func FindLoginsByID

func FindLoginsByID(s storage.Store) http.HandlerFunc

FindLoginsByID finds a login by id

func FindNoteByID

func FindNoteByID(s storage.Store) http.HandlerFunc

FindNoteByID finds a note by id

func FindServerByID

func FindServerByID(s storage.Store) http.HandlerFunc

FindServerByID ...

func FindSubscriptionByID added in v1.1.3

func FindSubscriptionByID(s storage.Store) http.HandlerFunc

FindSubscriptionByID ...

func FindUserByID

func FindUserByID(s storage.Store) http.HandlerFunc

FindUserByID ...

func GeneratePassword

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

GeneratePassword 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

Import ...

func Language

func Language(s storage.Store) http.HandlerFunc

Language ...

func Languages

func Languages(s storage.Store) http.HandlerFunc

Languages ...

func PostSubscription added in v1.1.3

func PostSubscription(s storage.Store) http.HandlerFunc

PostSubscription ...

func RecoverDelete added in v1.2.1

func RecoverDelete(s storage.Store) http.HandlerFunc

func RefreshToken

func RefreshToken(s storage.Store) http.HandlerFunc

RefreshToken ...

func RespondWithCookie added in v1.2.1

func RespondWithCookie(w http.ResponseWriter, code int, cookie *http.Cookie, payload interface{})

RespondWithToken

func RespondWithEncJSON added in v1.1.7

func RespondWithEncJSON(w http.ResponseWriter, code int, transmissionKey string, payload interface{})

RespondWithEncJSON encrypts returning json data

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 RespondWithHTML added in v1.1.3

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

RespondWithHTML write html

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 Signout added in v1.2.1

func Signout() http.HandlerFunc

func Signup

func Signup(s storage.Store) http.HandlerFunc

Signup ...

func TestLogin

func TestLogin(s storage.Store) http.HandlerFunc

TestLogin login endpoint for test purposes

func ToBody added in v1.1.7

func ToBody(r *http.Request, env, transmissionKey string) error

ToBody decrypts payload data and updates r.Body

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

UpdateBankAccount updates a bank account

func UpdateCreditCard

func UpdateCreditCard(s storage.Store) http.HandlerFunc

UpdateCreditCard updates a credit cart

func UpdateEmail

func UpdateEmail(s storage.Store) http.HandlerFunc

UpdateEmail ...

func UpdateLogin

func UpdateLogin(s storage.Store) http.HandlerFunc

UpdateLogin updates a login

func UpdateNote

func UpdateNote(s storage.Store) http.HandlerFunc

UpdateNote updates a note

func UpdateServer

func UpdateServer(s storage.Store) http.HandlerFunc

UpdateServer ...

func UpdateUser

func UpdateUser(s storage.Store) http.HandlerFunc

UpdateUser ...

func VerifyCode added in v1.1.7

func VerifyCode() http.HandlerFunc

Verify Email

Types

type ErrorResponseDTO

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

ErrorResponseDTO represents error resposne

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