Home Identifier Source Repository
import SirenAction from 'super-siren/lib/SirenAction.js'
public class | source

SirenAction

You can directly use instance of this class. sirenAction

Representation of a Siren action, which allows a state within a Siren Hypermedia API to transition to a new state.

Static Member Summary

Static Public Members
public static get

Default state for a SirenAction.

Static Method Summary

Static Public Methods
public static

fromJson(json: Object, baseUrl: String): SirenAction

Creates a SirenAction instance based on the provided

Method Summary

Public Methods
public

perform(data: Object): superagent-promise

Performs the action specified by this Action.

Static Public Members

public static get empty: SirenAction: * source

Default state for a SirenAction. This has the defaults set and nothing else.

Return:

SirenAction

Siren Action which is created as a result of parsing the provided JSON.

Static Public Methods

public static fromJson(json: Object, baseUrl: String): SirenAction source

Creates a SirenAction instance based on the provided JSON object structure.

Params:

NameTypeAttributeDescription
json Object

Object which matches the Siren JSON structure.

baseUrl String
  • optional

optional url to use as the base URL for all parsed URLs

Return:

SirenAction

Result of parsing the provided JSON object.

Public Methods

public perform(data: Object): superagent-promise source

Performs the action specified by this Action.

Params:

NameTypeAttributeDescription
data Object

Data to be sent as part of this action

Return:

superagent-promise

superagent promise representing the HTTP request to perform this action