You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18-12Lines changed: 18 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,8 @@
1
-
# Javascript DynamoDB Context Store
1
+
# Javascript DynamoDB Context Store
2
2
3
-
Used by the [SmartApp SDK](https://github.com/SmartThingsCommunity/smartapp-sdk-nodejs) to store IDs and access tokens for an installed instance of a SmartApp
4
-
and retrieves that information for use in asynchronous API calls. The use of a context store
5
-
is only needed when SmartApps have to call the SmartThings API in response to external
6
-
events. SmartApps that only response to lifecycle events from the SmartThings platform
7
-
will automatically have the proper context without the app having to store it.
Used by the [SmartApp SDK](https://github.com/SmartThingsCommunity/smartapp-sdk-nodejs) to store IDs and access tokens for an installed instance of a SmartApp and retrieves that information for use in asynchronous API calls. The use of a context store is only needed when SmartApps have to call the SmartThings API in response to external events. SmartApps that only response to lifecycle events from the SmartThings platform will automatically have the proper context without the app having to store it.
8
6
9
7
The context stored by this module consists of the following data elements:
10
8
@@ -17,20 +15,23 @@ The context stored by this module consists of the following data elements:
17
15
_Note: Version 2.X.X is a breaking change to version 1.X.X as far as configuring the context store is
18
16
concerned, but either one can be used with any version of the SmartThings SDK._
19
17
20
-
## Installation:
21
-
```
18
+
## Installation
19
+
20
+
```bash
22
21
npm install @smartthings/dynamodb-context-store
23
22
```
24
23
25
24
## Usage
26
25
27
26
Create a `DynamoDBContextStore` object and pass it to the SmartApp connector to store the context in a table
28
27
named `"smartapp"` in the `us-east-1` AWS region. If the table does not exist it will be created.
28
+
29
29
```javascript
30
30
smartapp.contextStore(newDynamoDBContextStore())
31
31
```
32
32
33
33
The more extensive set of options are shown in this example:
0 commit comments