feat(actions): Add support for <VAR>STATE</VAR> #24
6 changed files with 17 additions and 6 deletions
|
@ -258,6 +258,7 @@ occurrence is replaced before invocation as well.
|
||||||
| `<VAR>PROVIDER</VAR>` | The update's provider name invoking the action |
|
| `<VAR>PROVIDER</VAR>` | The update's provider name invoking the action |
|
||||||
| `<VAR>HOST</VAR>` | The update's host invoking the action |
|
| `<VAR>HOST</VAR>` | The update's host invoking the action |
|
||||||
| `<VAR>VERSION</VAR>` | The update's version (latest) invoking the action |
|
| `<VAR>VERSION</VAR>` | The update's version (latest) invoking the action |
|
||||||
|
| `<VAR>STATE</VAR>` | The update's state invoking the action |
|
||||||
|
|
||||||
#### shoutrrr
|
#### shoutrrr
|
||||||
|
|
||||||
|
|
|
@ -2403,6 +2403,12 @@ components:
|
||||||
type: string
|
type: string
|
||||||
version:
|
version:
|
||||||
type: string
|
type: string
|
||||||
|
state:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- pending
|
||||||
|
- approved
|
||||||
|
- ignored
|
||||||
ActionResponse:
|
ActionResponse:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
|
|
|
@ -339,6 +339,7 @@ type EventPayloadUpdateDeletedDto struct {
|
||||||
Provider string `json:"provider,omitempty"`
|
Provider string `json:"provider,omitempty"`
|
||||||
Host string `json:"host,omitempty"`
|
Host string `json:"host,omitempty"`
|
||||||
Version string `json:"version,omitempty"`
|
Version string `json:"version,omitempty"`
|
||||||
|
State string `json:"state,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewEventWindowResponse(content []*EventResponse, size int, skip int, orderBy string, order string, hasNext bool) *EventWindowResponse {
|
func NewEventWindowResponse(content []*EventResponse, size int, skip int, orderBy string, order string, hasNext bool) *EventWindowResponse {
|
||||||
|
|
|
@ -12,4 +12,5 @@ type eventPayloadInformationDto struct {
|
||||||
Application string
|
Application string
|
||||||
Provider string
|
Provider string
|
||||||
Version string
|
Version string
|
||||||
|
State string
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,6 +256,7 @@ func (s *actionInvocationService) replaceVars(str string, eventPayloadInfo *even
|
||||||
str = strings.ReplaceAll(str, "<VAR>PROVIDER</VAR>", eventPayloadInfo.Provider)
|
str = strings.ReplaceAll(str, "<VAR>PROVIDER</VAR>", eventPayloadInfo.Provider)
|
||||||
str = strings.ReplaceAll(str, "<VAR>HOST</VAR>", eventPayloadInfo.Host)
|
str = strings.ReplaceAll(str, "<VAR>HOST</VAR>", eventPayloadInfo.Host)
|
||||||
str = strings.ReplaceAll(str, "<VAR>VERSION</VAR>", eventPayloadInfo.Version)
|
str = strings.ReplaceAll(str, "<VAR>VERSION</VAR>", eventPayloadInfo.Version)
|
||||||
|
str = strings.ReplaceAll(str, "<VAR>STATE</VAR>", eventPayloadInfo.State)
|
||||||
|
|
||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,6 +82,7 @@ func (s *eventService) createUpdateDeleted(e *Update) *Event {
|
||||||
Provider: e.Provider,
|
Provider: e.Provider,
|
||||||
Host: e.Host,
|
Host: e.Host,
|
||||||
Version: e.Version,
|
Version: e.Version,
|
||||||
|
State: e.State,
|
||||||
})
|
})
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -210,37 +211,37 @@ func (s *eventService) extractPayloadInfo(event *Event) (*eventPayloadInformatio
|
||||||
if p, err = util.UnmarshalGenericJSON[api.EventPayloadUpdateCreatedDto](bytes); err != nil {
|
if p, err = util.UnmarshalGenericJSON[api.EventPayloadUpdateCreatedDto](bytes); err != nil {
|
||||||
return nil, newServiceError(General, err)
|
return nil, newServiceError(General, err)
|
||||||
}
|
}
|
||||||
return &eventPayloadInformationDto{Host: p.Host, Application: p.Application, Provider: p.Provider, Version: p.Version}, nil
|
return &eventPayloadInformationDto{Host: p.Host, Application: p.Application, Provider: p.Provider, Version: p.Version, State: p.State}, nil
|
||||||
case api.EventNameUpdateDeleted.Value():
|
case api.EventNameUpdateDeleted.Value():
|
||||||
var p api.EventPayloadUpdateDeletedDto
|
var p api.EventPayloadUpdateDeletedDto
|
||||||
if p, err = util.UnmarshalGenericJSON[api.EventPayloadUpdateDeletedDto](bytes); err != nil {
|
if p, err = util.UnmarshalGenericJSON[api.EventPayloadUpdateDeletedDto](bytes); err != nil {
|
||||||
return nil, newServiceError(General, err)
|
return nil, newServiceError(General, err)
|
||||||
}
|
}
|
||||||
return &eventPayloadInformationDto{Host: p.Host, Application: p.Application, Provider: p.Provider, Version: p.Version}, nil
|
return &eventPayloadInformationDto{Host: p.Host, Application: p.Application, Provider: p.Provider, Version: p.Version, State: p.State}, nil
|
||||||
case api.EventNameUpdateUpdatedApproved.Value():
|
case api.EventNameUpdateUpdatedApproved.Value():
|
||||||
var p api.EventPayloadUpdateUpdatedDto
|
var p api.EventPayloadUpdateUpdatedDto
|
||||||
if p, err = util.UnmarshalGenericJSON[api.EventPayloadUpdateUpdatedDto](bytes); err != nil {
|
if p, err = util.UnmarshalGenericJSON[api.EventPayloadUpdateUpdatedDto](bytes); err != nil {
|
||||||
return nil, newServiceError(General, err)
|
return nil, newServiceError(General, err)
|
||||||
}
|
}
|
||||||
return &eventPayloadInformationDto{Host: p.Host, Application: p.Application, Provider: p.Provider, Version: p.Version}, nil
|
return &eventPayloadInformationDto{Host: p.Host, Application: p.Application, Provider: p.Provider, Version: p.Version, State: p.State}, nil
|
||||||
case api.EventNameUpdateUpdatedPending.Value():
|
case api.EventNameUpdateUpdatedPending.Value():
|
||||||
var p api.EventPayloadUpdateUpdatedDto
|
var p api.EventPayloadUpdateUpdatedDto
|
||||||
if p, err = util.UnmarshalGenericJSON[api.EventPayloadUpdateUpdatedDto](bytes); err != nil {
|
if p, err = util.UnmarshalGenericJSON[api.EventPayloadUpdateUpdatedDto](bytes); err != nil {
|
||||||
return nil, newServiceError(General, err)
|
return nil, newServiceError(General, err)
|
||||||
}
|
}
|
||||||
return &eventPayloadInformationDto{Host: p.Host, Application: p.Application, Provider: p.Provider, Version: p.Version}, nil
|
return &eventPayloadInformationDto{Host: p.Host, Application: p.Application, Provider: p.Provider, Version: p.Version, State: p.State}, nil
|
||||||
case api.EventNameUpdateUpdatedIgnored.Value():
|
case api.EventNameUpdateUpdatedIgnored.Value():
|
||||||
var p api.EventPayloadUpdateUpdatedDto
|
var p api.EventPayloadUpdateUpdatedDto
|
||||||
if p, err = util.UnmarshalGenericJSON[api.EventPayloadUpdateUpdatedDto](bytes); err != nil {
|
if p, err = util.UnmarshalGenericJSON[api.EventPayloadUpdateUpdatedDto](bytes); err != nil {
|
||||||
return nil, newServiceError(General, err)
|
return nil, newServiceError(General, err)
|
||||||
}
|
}
|
||||||
return &eventPayloadInformationDto{Host: p.Host, Application: p.Application, Provider: p.Provider, Version: p.Version}, nil
|
return &eventPayloadInformationDto{Host: p.Host, Application: p.Application, Provider: p.Provider, Version: p.Version, State: p.State}, nil
|
||||||
case api.EventNameUpdateUpdated.Value():
|
case api.EventNameUpdateUpdated.Value():
|
||||||
var p api.EventPayloadUpdateUpdatedDto
|
var p api.EventPayloadUpdateUpdatedDto
|
||||||
if p, err = util.UnmarshalGenericJSON[api.EventPayloadUpdateUpdatedDto](bytes); err != nil {
|
if p, err = util.UnmarshalGenericJSON[api.EventPayloadUpdateUpdatedDto](bytes); err != nil {
|
||||||
return nil, newServiceError(General, err)
|
return nil, newServiceError(General, err)
|
||||||
}
|
}
|
||||||
return &eventPayloadInformationDto{Host: p.Host, Application: p.Application, Provider: p.Provider, Version: p.Version}, nil
|
return &eventPayloadInformationDto{Host: p.Host, Application: p.Application, Provider: p.Provider, Version: p.Version, State: p.State}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, newServiceError(General, errors.New("no matching event found"))
|
return nil, newServiceError(General, errors.New("no matching event found"))
|
||||||
|
|
Loading…
Reference in a new issue