Documentation
¶
Index ¶
- Constants
- Variables
- func CreateHttpHandler(handlers Handlers) func(http.ResponseWriter, *http.Request)
- func CreateHttpHandlerWithLogger(handlers Handlers, loggerCreator CreateLogger) func(http.ResponseWriter, *http.Request)
- func EntityRef(entities []interface{}, entityType string) string
- func EntityRefs(entities []interface{}, entityType string) []string
- func MakeEntity[E interface{}](value E, entityId ...string) E
- func NameFromEvent(event EventIncoming) string
- func ParseSpec(data []byte) (map[string]SkillSpec, error)
- func SendEventStatus(ctx context.Context, event EventIncoming, logger Logger, status Status) error
- func SendStatus(ctx context.Context, req RequestContext, status Status) error
- func Start(handlers Handlers)
- type CapabilitiesSpec
- type Catalog
- type Commands
- type Configuration
- type Configured
- type CreateLogger
- type DatalogSubscriptions
- type Declares
- type Entity
- type Env
- type EventContext
- type EventContextAsyncQueryResult
- type EventContextEvent
- type EventContextSubscription
- type EventContextSyncRequest
- type EventContextWebhook
- type EventHandler
- type EventIncoming
- type Handlers
- type Headers
- type Limit
- type Logger
- type ManyRef
- type OptionSpecs
- type Other
- type Owned
- type ParameterSpecs
- type ParameterValue
- type Providers
- type Provides
- type Request
- type RequestContext
- type Requires
- type ResourceProviderSpecs
- type Resources
- type Schemata
- type Skill
- type SkillDoc
- type SkillSpec
- type Status
- type Target
- type Transact
- type TransactOrdered
- type Transaction
- type Transactor
Constants ¶
View Source
const ( Completed edn.Keyword = "completed" Failed edn.Keyword = "failed" )
Variables ¶
View Source
var (
Log *logrus.Logger
)
Functions ¶
func CreateHttpHandler ¶ added in v0.0.28
func CreateHttpHandler(handlers Handlers) func(http.ResponseWriter, *http.Request)
func CreateHttpHandlerWithLogger ¶ added in v0.1.6
func CreateHttpHandlerWithLogger(handlers Handlers, loggerCreator CreateLogger) func(http.ResponseWriter, *http.Request)
func EntityRef ¶ added in v0.0.7
EntityRef finds one entity by given entityType and returns its identity
func EntityRefs ¶ added in v0.0.7
EntityRefs find all entities by given entityType and returns their identity
func MakeEntity ¶ added in v0.0.7
func MakeEntity[E interface{}](value E, entityId ...string) E
MakeEntity creates a new Entity struct populated with entity-type and a unique entity identifier
func NameFromEvent ¶ added in v0.0.7
func NameFromEvent(event EventIncoming) string
NameFromEvent extracts the name of either a subscription or webhook from the incoming payload
func SendEventStatus ¶ added in v0.1.10
func SendStatus ¶
func SendStatus(ctx context.Context, req RequestContext, status Status) error
Types ¶
type CapabilitiesSpec ¶ added in v0.0.63
type Configuration ¶ added in v0.0.7
type Configuration struct {
Name string `edn:"name"`
Parameters []ParameterValue `edn:"parameters,omitempty"`
}
type Configured ¶ added in v0.0.63
type DatalogSubscriptions ¶ added in v0.0.63
type Entity ¶ added in v0.0.7
type Entity struct {
EntityType edn.Keyword `edn:"schema/entity-type"`
Entity string `edn:"schema/entity,omitempty"`
}
Entity models the required fields to transact an entity
type EventContext ¶
type EventContext struct {
Subscription EventContextSubscription `edn:"subscription"`
Webhook EventContextWebhook `edn:"webhook"`
SyncRequest EventContextSyncRequest `edn:"sync-request"`
AsyncQueryResult EventContextAsyncQueryResult `edn:"query-result"`
Event EventContextEvent `edn:"event"`
}
type EventContextAsyncQueryResult ¶ added in v0.0.16
type EventContextAsyncQueryResult struct {
Name string `edn:"name"`
Configuration Configuration `edn:"configuration"`
Metadata string `edn:"metadata"`
Result edn.RawMessage `edn:"result"`
}
type EventContextEvent ¶ added in v0.0.16
type EventContextEvent struct {
Name string `edn:"name"`
Metadata map[edn.Keyword]edn.RawMessage `edn:"metadata"`
}
type EventContextSubscription ¶ added in v0.0.16
type EventContextSubscription struct {
Name string `edn:"name"`
Configuration Configuration `edn:"configuration"`
Result edn.RawMessage `edn:"result"`
Metadata struct {
AfterBasisT int64 `edn:"after-basis-t"`
Tx int64 `edn:"tx"`
ScheduleName string `edn:"schedule-name"`
} `edn:"metadata"`
}
func (*EventContextSubscription) GetResultInListForm ¶ added in v0.0.47
func (e *EventContextSubscription) GetResultInListForm() [][]edn.RawMessage
func (*EventContextSubscription) GetResultInMapForm ¶ added in v0.0.47
func (e *EventContextSubscription) GetResultInMapForm() []map[edn.Keyword]edn.RawMessage
type EventContextSyncRequest ¶ added in v0.0.16
type EventContextSyncRequest struct {
Name string `edn:"name"`
Configuration Configuration `edn:"configuration"`
Metadata edn.RawMessage `edn:"metadata"`
}
type EventContextWebhook ¶ added in v0.0.16
type EventContextWebhook struct {
Name string `edn:"name"`
Configuration Configuration `edn:"configuration"`
Request struct {
Url string `edn:"url"`
Body string `edn:"body"`
Headers map[string]string `edn:"headers"`
Tags []ParameterValue `edn:"tags"`
} `edn:"request"`
}
type EventHandler ¶
type EventHandler func(ctx context.Context, req RequestContext) Status
type EventIncoming ¶
type EventIncoming struct {
ExecutionId string `edn:"execution-id"`
Skill Skill `edn:"skill"`
Type edn.Keyword `edn:"type"`
WorkspaceId string `edn:"workspace-id"`
Environment string `edn:"environment,omitempty"`
Organization string `edn:"organization,omitempty"`
Context EventContext `edn:"context"`
Urls struct {
Execution string `edn:"execution"`
Logs string `edn:"logs"`
Transactions string `edn:"transactions"`
Query string `edn:"query"`
Graphql string `edn:"graphql"`
Entitlements string `edn:"entitlements"`
} `edn:"urls"`
Token string `edn:"token"`
}
type Handlers ¶
type Handlers func(name string) (EventHandler, bool)
func HandlersFromMap ¶ added in v0.1.7
func HandlersFromMap(handlers map[string]EventHandler) Handlers
type ManyRef ¶ added in v0.0.7
type ManyRef struct {
Add []string `edn:"add,omitempty"`
Set []string `edn:"set,omitempty"`
Retract []string `edn:"retract,omitempty"`
}
ManyRef models an entity reference of cardinality many
type OptionSpecs ¶ added in v0.0.63
type ParameterSpecs ¶ added in v0.0.63
type ParameterSpecs struct {
Description string `yaml:"description" json:"description"`
DisplayName string `yaml:"displayName" json:"displayName"`
Name string `yaml:"name" json:"name"`
Required bool `yaml:"required" json:"required"`
Visibility string `yaml:"visibility" json:"visibility"`
DefaultValue interface{} `yaml:"defaultValue" json:"defaultValue"`
DefaultValues []interface{} `yaml:"defaultValues" json:"defaultValues"`
Type string `yaml:"type" json:"type"`
Options []OptionSpecs `yaml:"options" json:"options"`
}
type ParameterValue ¶
type ParameterValue struct {
Name string `edn:"name"`
Value interface{} `edn:"value"`
}
type Providers ¶ added in v0.0.63
type Providers struct {
Catalog []Catalog `yaml:"catalog" json:"catalog"`
Configured []Configured `yaml:"configured" json:"configured"`
Other []Other `yaml:"other" json:"other"`
Owned []Owned `yaml:"owned" json:"owned"`
}
type RequestContext ¶ added in v0.0.4
type RequestContext struct {
Event EventIncoming
Log Logger
// contains filtered or unexported fields
}
func (*RequestContext) NewTransaction ¶ added in v0.0.7
func (r *RequestContext) NewTransaction() Transaction
type Requires ¶ added in v0.0.63
type Requires struct {
Description string `yaml:"description" json:"description"`
DisplayName string `yaml:"description" json:"displayName"`
MaxAllowed *int `yaml:"maxAllowed" json:"maxAllowed"`
MinRequired *int `yaml:"minRequired" json:"minRequired"`
Name string `yaml:"name" json:"name"`
Namespace string `yaml:"namespace" json:"namespace"`
Providers Providers `yaml:"providers" json:"providers"`
Scopes []string `yaml:"scopes" json:"scopes"`
Usage string `yaml:"usage" json:"usage"`
}
type ResourceProviderSpecs ¶ added in v0.0.63
type ResourceProviderSpecs struct {
Description string `yaml:"description" json:"description"`
DisplayName string `yaml:"displayName" json:"displayName"`
MaxAllowed int `yaml:"maxAllowed" json:"maxAllowed"`
MinRequired int `yaml:"minRequired" json:"minRequired"`
Name string `yaml:"name" json:"name"`
TypeName string `yaml:"typeName" json:"typeName"`
}
type SkillDoc ¶ added in v0.0.66
type SkillDoc struct {
Skill SkillSpec `yaml:"skill" json:"skill"`
}
type SkillSpec ¶ added in v0.0.63
type SkillSpec struct {
APIVersion string `yaml:"apiVersion" json:"apiVersion"`
Author string `yaml:"author" json:"author"`
CapabilitiesSpec CapabilitiesSpec `yaml:"capabilititesSpec" json:"capabilitiesSpec"`
Commands []Commands `yaml:"commands" json:"commands"`
CreatedAt time.Time `yaml:"createdAt" json:"createdAt"`
DatalogSubscriptions []DatalogSubscriptions `yaml:"datalogSubscriptions" json:"datalogSubscriptions"`
Derived bool `yaml:"derived" json:"derived"`
Description string `yaml:"description" json:"description"`
DispatchStyle string `yaml:"dispatchStyle" json:"dispatchStyle"`
DisplayName string `yaml:"displayName" json:"displayName"`
HomepageURL string `yaml:"homepageUrl" json:"homepageUrl"`
IconURL string `yaml:"iconUrl" json:"iconUrl"`
InCatalog bool `yaml:"inCatalog" json:"inCatalog"`
Ingesters []string `yaml:"ingesters" json:"ingesters"`
Integration bool `yaml:"integration" json:"integration"`
License string `yaml:"license" json:"license"`
LongDescription string `yaml:"longDescription" json:"longDescription"`
Maturities []string `yaml:"maturities" json:"maturities"`
MaxConfigurations int `yaml:"maxConfigurations" json:"maxConfigurations"`
Name string `yaml:"name" json:"name"`
Namespace string `yaml:"namespace" json:"namespace"`
Owner bool `yaml:"owner" json:"owner"`
ParameterSpecs []ParameterSpecs `json:"parameterSpecs"`
YamlParameters []map[string]ParameterSpecs `yaml:"parameters"`
Platform string `yaml:"platform" json:"platform"`
PublishedAt time.Time `yaml:"publishedAt" json:"publishedAt"`
Readme string `yaml:"readme" json:"readme"`
ResourceProviderSpecs []ResourceProviderSpecs `yaml:"resourceProviderSpecs" json:"resourceProviderSpecs"`
Rules *[]string `yaml:"rules,omitempty" json:"rules,omitempty"`
Schemata []Schemata `yaml:"schemata" json:"schemata"`
Subscriptions []string `yaml:"subscriptions" json:"subscriptions"`
Target *Target `yaml:"target,omitempty" json:"target,omitempty"`
Technologies []string `yaml:"technologies" json:"technologies"`
Version string `yaml:"version" json:"version"`
VideoURL string `yaml:"videoUrl" json:"videoUrl"`
}
type Status ¶
type Status struct {
State edn.Keyword `edn:"state"`
Reason string `edn:"reason,omitempty"`
SyncRequest interface{} `edn:"sync-request,omitempty"`
}
func NewCompletedStatus ¶ added in v0.0.7
func NewFailedStatus ¶ added in v0.0.7
func NewRetryableStatus ¶ added in v0.0.14
func NewRunningStatus ¶ added in v0.1.6
type TransactOrdered ¶
type Transaction ¶
type Transaction interface {
Ordered() Transaction
AddEntities(entities ...interface{}) Transaction
EntityRefs(entityType string) []string
EntityRef(entityType string) string
Transact() error
}
Transaction collects entities
func NewTransaction ¶ added in v0.0.67
func NewTransaction(ctx context.Context, transactor Transactor) Transaction
func NewTransactionFromRequest ¶ added in v0.1.9
func NewTransactionFromRequest(ctx context.Context, event EventIncoming, logger Logger) Transaction
type Transactor ¶ added in v0.0.7
func NewHttpTransactor ¶ added in v0.0.67
func NewStringTransactor ¶ added in v0.0.67
func NewStringTransactor(stringTransactionFunc func(string)) Transactor
Source Files
¶
Click to show internal directories.
Click to hide internal directories.