eserating-chwy
released this
05 Mar 18:33
·
1 commit
to master
since this release
This release adds the ability to have 'urlParams' and 'headers' defined on an action. They use the same Siren4JActionField as the 'fields' do. But they are grouped as urlParams or headers to give clear functional separation as to what they are for.
These are particularly useful for GET type actions. Allowing the server to provide the client with enough meta for the client to properly form a request complete with urlParams and headers.
Example:
@Siren4JAction( name = "addReview",
title = "Add a Review", method = Method.POST,
href = "/courseReviews/course/{courseid}", type = "application/json",
condition = @Siren4JCondition(name = "somefield", logic=Is.TRUE),
fields = { @Siren4JActionField(name = "userid", type = "text",
required = true ),
@Siren4JActionField(name = "body",
type = "text", required = true, maxLength = 250) } ,
urlParams = { @Siren4JActionField(name = "filter-by", type = "text",
required = true ) })
Also added to an action is a metadata to allow custom data on an action as an associative array.
metaData = {
@Siren4JMetaData(key = "actionExtraStuff1", value = "hello"),
@Siren4JMetaData(key = "actionExtraStuff2", value = "more stuff")
}