NewActionFromObject create Action object from json
(id string, rawData interface{})
| 47 | |
| 48 | // NewActionFromObject create Action object from json |
| 49 | func NewActionFromObject(id string, rawData interface{}) (Action, error) { |
| 50 | actionData, _ := rawData.(map[string]interface{}) |
| 51 | method, _ := actionData["method"].(string) |
| 52 | path, _ := actionData["path"].(string) |
| 53 | description, _ := actionData["description"].(string) |
| 54 | inputSchema, _ := actionData["input"].(map[string]interface{}) |
| 55 | outputSchema, _ := actionData["output"].(map[string]interface{}) |
| 56 | parameters, _ := actionData["parameters"].(map[string]interface{}) |
| 57 | return NewAction(id, method, path, description, inputSchema, outputSchema, parameters), nil |
| 58 | } |
| 59 | |
| 60 | // TakesID checks if action takes ID as a parameter |
| 61 | func (action *Action) TakesID() bool { |
no test coverage detected