Skip to content

Commit

Permalink
add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienEtienne committed Dec 1, 2016
1 parent 3d4c7bc commit c4edd59
Showing 1 changed file with 31 additions and 13 deletions.
44 changes: 31 additions & 13 deletions docs/how-to-use.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## Example

```
import actionsInteractor from 'actions-interactor';
import actionsInteractor, {Types} from 'actions-interactor';
interactor = actionsInteractor.create({
name:'My interactor',
description:'My description'
Expand All @@ -17,6 +17,12 @@ console.log(interactor);
// actions:[]
// }
interactor.addAction({
name:'Name'
description:'Description',
type: Types.ACTION_BASE
})
```

## API
Expand All @@ -28,6 +34,21 @@ interactor object :
* description: String,
* actions: [Action](#action)[]

## <a name="action_type">ACTION_TYPE</a>
```
import {Types} from 'actions-interactor';
```

- ACTION_BASE:
- name: `String`
- description: `String`
- ACTION_INPUT: as ACTION_BASE plus
- required: `Boolean`
- defaultValue: `String`
- ACTION_COMBO: as ACTION_BASE plus
- required: `Boolean`
- choices: `Array`

## Classes

### <a name="interactor">Interactor</a>
Expand All @@ -44,20 +65,17 @@ interactor object :

Return true if all actions are valid.

##### addInfo(name: String, description: String): boolean

Add an action "information" to the list of actions
Return true if action added.

##### addInput(name: String, description: String[, required: boolean, defaultValue: :string]): boolean

Add an action "input box" to the list of actions
Return true if action added.
##### addAction(obj: Object)

##### addCombo(name: String, description: String, required: boolean, choices: Choice[]): boolean
Add an action to the list of actions

Add an action "combo" to the list of actions
Return true if action added.
obj :
- name: `String`
- description: `String`
- type: [`ACTION_TYPE`](#action_type)
- required: `Boolean`
- defaultValue: `String`,
- choices: `Array`

### <a name="action">Action</a>

Expand Down

0 comments on commit c4edd59

Please sign in to comment.