api

package
v0.0.0-...-9e72f66 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2022 License: MIT Imports: 29 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 BulkUpdateCreditCards

func BulkUpdateCreditCards(s db.Store) http.HandlerFunc

BulkUpdateCreditCards updates creditCards in payload

func BulkUpdateEmails

func BulkUpdateEmails(s db.Store) http.HandlerFunc

BulkUpdateEmails updates emails in payload

func BulkUpdateLogins

func BulkUpdateLogins(s db.Store) http.HandlerFunc

BulkUpdateLogins updates logins in payload

func BulkUpdateNotes

func BulkUpdateNotes(s db.Store) http.HandlerFunc

BulkUpdateNotes updates notes in payload

func BulkUpdateServers

func BulkUpdateServers(s db.Store) http.HandlerFunc

BulkUpdateServers updates servers in payload

func ChangePasswordRequest

func ChangePasswordRequest(masterPassword, email string) string

func CheckCredentials

func CheckCredentials(s db.Store) http.HandlerFunc

CheckCredentials ...

func CheckToken

func CheckToken(s db.Store) http.HandlerFunc

CheckToken ...

func CreateCode

func CreateCode(s db.Store) http.HandlerFunc

Create email verification code

func CreateCreditCard

func CreateCreditCard(s db.Store) http.HandlerFunc

CreateCreditCard creates a credit cart

func CreateDeleteCode

func CreateDeleteCode(s db.Store) http.HandlerFunc

Create user deletion code

func CreateEmail

func CreateEmail(s db.Store) http.HandlerFunc

CreateEmail ...

func CreateLogin

func CreateLogin(s db.Store) http.HandlerFunc

CreateLogin creates a login

func CreateNote

func CreateNote(s db.Store) http.HandlerFunc

CreateNote creates a note

func CreateServer

func CreateServer(s db.Store) http.HandlerFunc

CreateServer ...

func CreateSubscription

func CreateSubscription(s db.Store) http.HandlerFunc

CreateSubscription ...

func CreateUser

func CreateUser(s db.Store) http.HandlerFunc

CreateUser ...

func DeleteCreditCard

func DeleteCreditCard(s db.Store) http.HandlerFunc

DeleteCreditCard deletes a credit cart

func DeleteEmail

func DeleteEmail(s db.Store) http.HandlerFunc

DeleteEmail ...

func DeleteLogin

func DeleteLogin(s db.Store) http.HandlerFunc

DeleteLogin deletes a login

func DeleteNote

func DeleteNote(s db.Store) http.HandlerFunc

DeleteNote deletes a note

func DeleteServer

func DeleteServer(s db.Store) http.HandlerFunc

DeleteServer ...

func DeleteSubscription

func DeleteSubscription(s db.Store) http.HandlerFunc

DeleteSubscription ...

func DeleteUser

func DeleteUser(s db.Store) http.HandlerFunc

DeleteUser ...

func EmailVerification

func EmailVerification(email, code string) string

func Export

func Export(s db.Store) http.HandlerFunc

Export exports all logins as CSV file Export exports all data as CSV file

func FindAllCreditCards

func FindAllCreditCards(s db.Store) http.HandlerFunc

FindAllCreditCards finds all credid carts

func FindAllEmails

func FindAllEmails(s db.Store) http.HandlerFunc

FindAllEmails ...

func FindAllLogins

func FindAllLogins(s db.Store) http.HandlerFunc

FindAllLogins finds all logins

func FindAllNotes

func FindAllNotes(s db.Store) http.HandlerFunc

FindAllNotes finds all notes

func FindAllServers

func FindAllServers(s db.Store) http.HandlerFunc

FindAllServers ...

func FindAllSubscriptions

func FindAllSubscriptions(s db.Store) http.HandlerFunc

FindAllSubscriptions ...

func FindAllUsers

func FindAllUsers(s db.Store) http.HandlerFunc

FindAllUsers ...

func FindCreditCardByID

func FindCreditCardByID(s db.Store) http.HandlerFunc

FindCreditCardByID finds a credit cart by id

func FindEmailByID

func FindEmailByID(s db.Store) http.HandlerFunc

FindEmailByID ...

func FindLoginsByID

func FindLoginsByID(s db.Store) http.HandlerFunc

FindLoginsByID finds a login by id

func FindNoteByID

func FindNoteByID(s db.Store) http.HandlerFunc

FindNoteByID finds a note by id

func FindServerByID

func FindServerByID(s db.Store) http.HandlerFunc

FindServerByID ...

func FindSubscriptionByID

func FindSubscriptionByID(s db.Store) http.HandlerFunc

FindSubscriptionByID ...

func FindUserByID

func FindUserByID(s db.Store) http.HandlerFunc

FindUserByID ...

func ForgotMasterPassword

func ForgotMasterPassword(s db.Store) http.HandlerFunc

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 db.Store) http.HandlerFunc

HealthCheck ...

func Import

func Import(s db.Store) http.HandlerFunc

Import ...

func Language

func Language(s db.Store) http.HandlerFunc

Language ...

func Languages

func Languages(s db.Store) http.HandlerFunc

Languages ...

func PostSubscription

func PostSubscription(s db.Store) http.HandlerFunc

PostSubscription ...

func RecoverDelete

func RecoverDelete(s db.Store) http.HandlerFunc

func RefreshToken

func RefreshToken(s db.Store) http.HandlerFunc

RefreshToken ...

func ResetMasterPasswordInstructions

func ResetMasterPasswordInstructions(email, code string) string

func RespondWithCookie

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

RespondWithCookie

func RespondWithEncJSON

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 RespondWithJSON

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

RespondWithJSON write json

func Restore

func Restore(s db.Store) http.HandlerFunc

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

func SendFMP

func SendFMP(s db.Store) http.HandlerFunc

func SetArgs

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

SetArgs ...

func Signin

func Signin(s db.Store) http.HandlerFunc

Signin ...

func Signout

func Signout() http.HandlerFunc

func Signup

func Signup(s db.Store) http.HandlerFunc

Signup ...

func TestLogin

func TestLogin(s db.Store) http.HandlerFunc

TestLogin login endpoint for test purposes

func ToBody

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 UpdateCreditCard

func UpdateCreditCard(s db.Store) http.HandlerFunc

UpdateCreditCard updates a credit cart

func UpdateEmail

func UpdateEmail(s db.Store) http.HandlerFunc

UpdateEmail ...

func UpdateLogin

func UpdateLogin(s db.Store) http.HandlerFunc

UpdateLogin updates a login

func UpdateNote

func UpdateNote(s db.Store) http.HandlerFunc

UpdateNote updates a note

func UpdateServer

func UpdateServer(s db.Store) http.HandlerFunc

UpdateServer ...

func UpdateUser

func UpdateUser(s db.Store) http.HandlerFunc

UpdateUser ...

func VerifyCode

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