node-api/types.go
Adam Štrauch bc875b83a4
All checks were successful
Unittests / unittests (push) Successful in 14s
Unittests / deploy-dev (push) Successful in 47s
Add Bun
2024-07-13 12:05:40 +02:00

73 lines
2.0 KiB
Go

package main
import (
"encoding/json"
)
// RequestMessage message
type RequestMessage struct {
AppName string `json:"name"`
Type string `json:"type"`
Payload string `json:"payload"`
}
type StateMessage struct {
AppName string `json:"name"` // Name of the related application stored in the main database
Error bool `json:"error"` // True if the message is an error message
Message string `json:"message"`
}
func (s *StateMessage) JSON() ([]byte, error) {
return json.Marshal(s)
}
// ReplyMessage is returned as reply to a message that requires replying
type ReplyMessage struct {
AppName string `json:"name,omitempty"`
Error bool `json:"error,omitempty"` // True if this message is an error message and in that case Payload is string with an error message, otherwise it's standard response
Payload interface{} `json:"payload"`
}
// Message represents response with information about results of something
type Message struct {
// Message with different kind of information. Usually it's error message generated by dependencies or stdlib or simply ok.
// Example: ok
// Required: false
Message string `json:"message,omitempty"`
// If there are any errors all of them are listed here.
// Required: false
Errors []string `json:"errors,omitempty"`
}
// data passed into the template
type templateData struct {
Token string
}
// Password is request structure you can use to pass password for app user in the container
type Password struct {
Password string `json:"password"`
}
// QuickServices comes from client and say what technology or service enable in the container
type QuickServices struct {
Python bool `json:"python"`
Node bool `json:"node"`
PHP bool `json:"php"`
Ruby bool `json:"ruby"`
Deno bool `json:"deno"`
Bun bool `json:"bun"`
Memcached bool `json:"memcached"`
Redis bool `json:"redis"`
}
// Set technology
type Technology struct {
Name string
Version string
}
type createSnapshotBody struct {
Labels []string `json:"labels"`
}