api

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: GPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdminIndexHandler

func AdminIndexHandler(c echo.Context) error

Returns the app.html file

func AdminUserGetHandler

func AdminUserGetHandler(e echo.Context) error

Returns a user by ID

func AdminUserListHandler

func AdminUserListHandler(e echo.Context) error

Lists all users

func AdminUserUpdateHandler

func AdminUserUpdateHandler(e echo.Context) error

Update a user's metadata

func ChallengeHandler

func ChallengeHandler(e echo.Context) error

Returns a string in plaintext, containing the message to be signed. Returns 400 => Bad Request if no session is found

func ChangeEmail

func ChangeEmail(e echo.Context) error

Update a users' e-mail address

@param tokenID => string => Request token @returns

	200 => OK
	400 => Token request not found
 417 => Data layer error
}

func ChangeEmailRequest

func ChangeEmailRequest(e echo.Context) (err error)

Start a users email change request

@param tokenRequest => {
		Email  string    `json:"email" validate:"email=true,required=true"`
		Token  string    `json:"token"`
		UserID string    `json:"userID"`
		Role   Role      `json:"role"`
		Type   TokenType `json:"type"`
	}

@returns

	200 => OK
	401 => Unauthorized
 417 => E-Mail error
 422 => Input error
 500 => Token error
}

func CheckForWorkflowPayment

func CheckForWorkflowPayment(e echo.Context) error

Check if a payment is required for current user for the workflow. Return http OK if no payment is required or if payment is required and a payment a matching payment with status = "confirmed" is found

func ConfigHandler

func ConfigHandler(version string) echo.HandlerFunc

Returns an object containing the following config parameters

{
  roles => string[] => Possible User Roles
  blockchainNet => string => Settings.BlockchainNet
  blockchainProxeusFSAddress => string => Settings.BlockchainContractAddress
  version => string => Proxeus version
}

func CreateApiKeyHandler

func CreateApiKeyHandler(e echo.Context) error

Remove the users' auth session

@params => {
  name => string,
  ID => string,
}

@returns

	200 => apiKey string
 400 => Data layer error/Validation error
 401 => Unauthorized

func DeleteApiKeyHandler

func DeleteApiKeyHandler(e echo.Context) error

Remove the users' auth session

@params => {
  ID => string,
}

@returns

	200 => apiKey string
 400 => Data layer error
 401 => Unauthorized

func DeleteSessionTokenHandler

func DeleteSessionTokenHandler(e echo.Context) (err error)

Ends the context's session and returns 200 => OK in any case

func DocumentDataHandler

func DocumentDataHandler(e echo.Context) error

Update a document with data

@params ID => string

FormInput => map[string]interface{}

@returns

	200 => OK
 400 => Bad request
 422 => Unprocessable entity
 500 => Server error

func DocumentDeleteHandler

func DocumentDeleteHandler(e echo.Context) error

Delete a document

@params ID => string @returns

	200 => OK
 400 => Bad request

func DocumentEditHandler

func DocumentEditHandler(e echo.Context) error

Update a document

@params ID => string, FormInput => interface{} @returns

	200 => OK
 400 => Bad request
 422 => Unprocessable entity

func DocumentFileGetHandler

func DocumentFileGetHandler(e echo.Context) error

Returns a document's file output

@params ID => string

inputName => string

@returns

	200 => map[string]interface{}
 404 => Not found

func DocumentFilePostHandler

func DocumentFilePostHandler(e echo.Context) error

Attach a file to a document

@params @Fileinput

ID => string
inputName => string

func DocumentHandler

func DocumentHandler(e echo.Context) error

Process a document

@params ID => string @returns

	200 => map[string]interface{}{"name" => string, "status" => string}
 400 => Bad request
 404 => Not found
 422 => Unprocessable entity
 500 => Server error

func DocumentNextHandler

func DocumentNextHandler(e echo.Context) error

Move one step further in the document process

@params ID => string

final => boolean,
FormInput => map[string]interface{}

@returns

	200 => map[string]interface{}
 400 => Bad request
 401 => Unauthorized
 422 => Unprocessable entity

func DocumentPrevHandler

func DocumentPrevHandler(e echo.Context) error

Move one step back in the document process

@params ID => string @returns

	200 => status => string
 400 => Bad request

func DocumentPreviewHandler

func DocumentPreviewHandler(e echo.Context) error

Returns a preview of the document in PDF form

func Export

func Export(sess *sys.Session, exportEntities []portable.EntityType, e echo.Context, id ...string) error

Helper function for all exports

@returns

	200 => File
	400 => Bad Request
 422 => Input error
}

func ExportSettings

func ExportSettings(e echo.Context) error

Export platform settings

@returns

	200 => File
	400 => Bad Request
 422 => Input error
}

func ExportUser

func ExportUser(e echo.Context) error

Export a user record

@params

contains string
id 		 string

@returns

	200 => File
	400 => Bad Request
 422 => Input error
}

func ExportUserData

func ExportUserData(e echo.Context) error

Exports user data

@params

contains string
id 		 string

@returns

	200 => File
	400 => Bad Request
 401 => StatusUnauthorized
 422 => Input error
}

func ExternalConfigRetrieve

func ExternalConfigRetrieve(e echo.Context) error

Returns the config of an external node

func ExternalConfigStore

func ExternalConfigStore(e echo.Context) error

Update the config of an external store

func ExternalConfigurationPage

func ExternalConfigurationPage(e echo.Context) error

Instantiate an external node and return the config URL

func ExternalList

func ExternalList(e echo.Context) error

List external nodes

func ExternalRegister

func ExternalRegister(e echo.Context) error

Register an external node

@param node => {
		ID     string `json:"id" storm:"id"`
		Name   string `json:"name"`
		Detail string `json:"detail"`
		Url    string `json:"url"`
		Secret string `json:"secret"`
	}

func GetExport

func GetExport(e echo.Context) error

Returns exported entities

@params

include string
EntityType  []string

@returns

	200 => File
	400 => Bad Request
 422 => Input error
}

func GetExportResults

func GetExportResults(e echo.Context) error

Returns the last exported records stored in the user session

@params @returns

	200 => imexResults
	401 => StatusUnauthorized
}

func GetImportResults

func GetImportResults(e echo.Context) error

Returns the last imported records from the user session

@params

delete boolean

@returns

	200 => imex results
	401 => Unauthorized
}

func GetInit

func GetInit(e echo.Context) error

Returns the platform settings and the "configured" flag that defines whether the user is configured or not

@returns

	200 => map[string]interface{}{"settings": settings, "configured": configured}
	500 => Server error
}

func GetProfilePhotoHandler

func GetProfilePhotoHandler(e echo.Context) error

Returns a profile photo

@params id => string @returns

	200 => File
 404 => Not found
}

func GetSessionTokenHandler

func GetSessionTokenHandler(e echo.Context) (err error)

Returns an object containing

{
  token => string => Session ID
}

func InviteRequest

func InviteRequest(e echo.Context) (err error)

Invite a user

@params TokenRequest struct {
		Email  string    `json:"email" validate:"email=true,required=true"`
		Token  string    `json:"token"`
		UserID string    `json:"userID"`
		Role   Role      `json:"role"`
		Type   TokenType `json:"type"`
	}

@returns

	200 => OK
 422 => unprocessable entity
	500 => Server error
}

func LoginHandler

func LoginHandler(e echo.Context) (err error)

Create an auth session

@params => {
	Signature string
	Name      string `json:"name" form:"name"`
	Email     string `json:"email" form:"email"`
	Password  string `json:"password" form:"password"`
	Address   string `json:"address" form:"address"`
}

@returns

	200 => OK => {
		"location": redirectAfterLogin(user.Role, string(referer)),
		"created":  created,
	}
 400 => Auth error
}

func LogoutHandler

func LogoutHandler(e echo.Context) error

Remove the users' auth session

@params => nil @returns

200 => OK => {
	"location": "/"
}

func MeHandler

func MeHandler(e echo.Context) error

Returns the user object from the session

@params => - @returns

	200 => User => {}
 404 => Not found
}

func MeUpdateHandler

func MeUpdateHandler(e echo.Context) error

Returns the user object from the session

@params => - @returns

	200 => User => {}
 404 => Not found

func PostImport

func PostImport(e echo.Context) error

Imports a file containing exported entities

@params

skipExisting string
File File (in body)

@returns

	200 => OK
	400 => Bad Request
 422 => Input error
}

func PostInit

func PostInit(e echo.Context) error

Initialize the system

@params initStruct => struct {
		Settings *model.Settings `json:"settings"`
		User     *usr            `json:"user"`
	}

@returns

	200 => OK
 422 => unprocessable entity
	500 => Server error
}

func PublicIndexHTMLHandler

func PublicIndexHTMLHandler(c echo.Context) error

Returns the frontend.html file

func PutProfilePhotoHandler

func PutProfilePhotoHandler(e echo.Context) error

Returns the user object from the session

@params => - @returns

	200 => User => {}
 404 => Not found

func PutTestSignature

func PutTestSignature(e echo.Context) error

func Register

func Register(e echo.Context) error

Persists a registration request

@params => {
	 string => token
  string => password
}

@returns

	200 => OK
 417 => Token not found/User not found/Data Layer error
 422 => Input validation error
}

func RegisterRequest

func RegisterRequest(e echo.Context) (err error)

Handles a registration request

@params => {
		Email  string    `json:"email" validate:"email=true,required=true"`
		Token  string    `json:"token"`
		UserID string    `json:"userID"`
		Role   Role      `json:"role"`
		Type   TokenType `json:"type"`
	}

@returns

	200 => OK
 417 => E-Mail error
 422 => Input validation error
 500 => Data layer error
}

func ResetPassword

func ResetPassword(e echo.Context) error

Reset a users' password

@params => string => tokenID @returns

	200 => OK
 417 => Data layer error
 422 => Input validation error
}

func ResetPasswordRequest

func ResetPasswordRequest(e echo.Context) (err error)

Start a user password change request

@params => {
		Email  string    `json:"email" validate:"email=true,required=true"`
		Token  string    `json:"token"`
		UserID string    `json:"userID"`
		Role   Role      `json:"role"`
		Type   TokenType `json:"type"`
	}

@returns

	200 => OK
	400 => Token request not found
 417 => E-Mail error
 422 => Input validation error
 500 => Token error
}

func SharedByLinkHTMLHandler

func SharedByLinkHTMLHandler(c echo.Context) error

Returns the app.html file

func SwitchUserHandler

func SwitchUserHandler(e echo.Context) error

root only feature to switch user by address - useful for permission checks

func UpdateAddress

func UpdateAddress(e echo.Context) error

Update a users' blockchain address

@param loginForm => {
	Signature string
	Name      string `json:"name" form:"name"`
	Email     string `json:"email" form:"email"`
	Password  string `json:"password" form:"password"`
	Address   string `json:"address" form:"address"`
}

@returns

	200 => OK
	401 => Unauthorized
 422 => Challenge error/Signature error
 500 => User not found
}

func UserBackendHTMLHandler

func UserBackendHTMLHandler(c echo.Context) error

Returns the user.html file

func UserDeleteHandler

func UserDeleteHandler(e echo.Context) error

Remove a user from the database

func UserDocumentFileHandler

func UserDocumentFileHandler(e echo.Context) error

Returns a file belonging to a users document

func UserDocumentGetHandler

func UserDocumentGetHandler(e echo.Context) error

Returns a documents metadata

func UserDocumentListHandler

func UserDocumentListHandler(e echo.Context) error

Returns a list of paginated user documents

func UserDocumentSignatureRequestAddHandler

func UserDocumentSignatureRequestAddHandler(e echo.Context) error

Add a signature request for a document

func UserDocumentSignatureRequestGetByDocumentIDHandler

func UserDocumentSignatureRequestGetByDocumentIDHandler(e echo.Context) error

Returns a signature request based on a provided document ID

func UserDocumentSignatureRequestGetCurrentUserHandler

func UserDocumentSignatureRequestGetCurrentUserHandler(e echo.Context) error

Returns a signature request for the current user

func UserDocumentSignatureRequestRejectHandler

func UserDocumentSignatureRequestRejectHandler(e echo.Context) error

Reject a signature request for a document

func UserDocumentSignatureRequestRevokeHandler

func UserDocumentSignatureRequestRevokeHandler(e echo.Context) error

Revoke a documents signature

func ValidateUserSession

func ValidateUserSession(e echo.Context) (err error)

Validates user session cookie

func WorkflowExecuteAtOnce

func WorkflowExecuteAtOnce(e echo.Context) error

Execute a workflow at once

func WorkflowSchema

func WorkflowSchema(e echo.Context) error

Returns a workflows schema

Types

type ImportExportResult

type ImportExportResult struct {
	Filename  string                    `json:"filename"`
	Timestamp time.Time                 `json:"timestamp"`
	Results   portable.ProcessedResults `json:"results"`
}

type UserWithPw

type UserWithPw struct {
	model.User
	Password string `json:"password,omitempty"`
}

Jump to

Keyboard shortcuts

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