dashboard

package
v0.0.0-...-c4bfc47 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddIntent

func AddIntent(locale string, intent analysis.Intent)

AddIntent adds the given intent to the intents file

func Authenticate

func Authenticate()

Authenticate checks if the authentication file exists and if not it generates the file with a new token

func AuthenticationFileExists

func AuthenticationFileExists() bool

AuthenticationFileExists checks if the authentication file exists and return the condition

func ChecksToken

func ChecksToken(token string) bool

ChecksToken checks if the given token is the good one from the authentication file

func CreateIntent

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

CreateIntent is the route to create a new intent

func DeleteIntent

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

DeleteIntent is the route used to delete an intent

func GenerateToken

func GenerateToken() string

GenerateToken generates a random token of 30 characters and returns it

func GetIntents

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

GetIntents is the route to get the intents

func HashToken

func HashToken(token string) []byte

HashToken gets the given tokens and returns its hash using bcrypt

func RemoveIntent

func RemoveIntent(locale, tag string)

RemoveIntent removes the intent with the given tag from the intents file

func SaveHash

func SaveHash(hash string)

SaveHash saves the given hash to the authentication file

func WriteIntents

func WriteIntents(locale string, intents []analysis.Intent)

WriteIntents writes the given intents to the intents file

Types

type DeleteRequest

type DeleteRequest struct {
	Tag string `json:"tag"`
}

DeleteRequest is for the parameters required to delete an intent via the REST Api

type Error

type Error struct {
	Message string `json:"message"`
}

An Error is what the api replies when an error occurs

Jump to

Keyboard shortcuts

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