Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #11

Merged
merged 3 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,24 @@ $ npm install elarian@latest

```javascript

// on node
const { initializeClient } = require('elarian');
/*
or in the browser
<script src="web.js"></script>
// or import { initializeClient } from 'elarian/web'
*/


// ...

const elarian = await initializeClient({
apiKey: 'YOUR_API_KEY', // or authToken: 'YOUR_AUTH_TOKEN'
orgId: 'YOUR_ORG_ID',
sessionId: 'YOUR_SESSION_ID',
appId: 'YOUR_APP_ID',
});

elarian.on('reminder', (data, customer) => {
elarian.on('consentDenied', (userId, data) => {
// ...
});

const userId = 'abc...';
const { state } = await elarian.leaseAppState(userId);
const data = JSON.parse(state.stringVal);
await elarian.updateAppState(userId, { stringVal: JSON.stringify({ ...data, status: 'good boy' }) });
await elarian.updateMetadata(userId, { bio: { bytesVal: Buffer.from('age=29;gender=female') }});
const { state } = await elarian.fetchAppState();
const data = JSON.parse(state.toString());
await elarian.updateAppState({ state: Buffer.from(JSON.stringify({ ...data, status: 'good boy' })) });

```

Expand Down
14 changes: 7 additions & 7 deletions docs/Client.html
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="client.js.html">client.js</a>, <a href="client.js.html#line31">line 31</a>
<a href="client.js.html">client.js</a>, <a href="client.js.html#line16">line 16</a>
</li></ul></dd>


Expand Down Expand Up @@ -250,7 +250,7 @@ <h4 class="name" id="connect"><span class="type-signature"></span>connect<span c

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="client.js.html">client.js</a>, <a href="client.js.html#line110">line 110</a>
<a href="client.js.html">client.js</a>, <a href="client.js.html#line62">line 62</a>
</li></ul></dd>


Expand Down Expand Up @@ -360,7 +360,7 @@ <h4 class="name" id="disconnect"><span class="type-signature"></span>disconnect<

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="client.js.html">client.js</a>, <a href="client.js.html#line171">line 171</a>
<a href="client.js.html">client.js</a>, <a href="client.js.html#line82">line 82</a>
</li></ul></dd>


Expand Down Expand Up @@ -448,7 +448,7 @@ <h4 class="name" id="isConnected"><span class="type-signature"></span>isConnecte

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="client.js.html">client.js</a>, <a href="client.js.html#line164">line 164</a>
<a href="client.js.html">client.js</a>, <a href="client.js.html#line75">line 75</a>
</li></ul></dd>


Expand Down Expand Up @@ -626,7 +626,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="client.js.html">client.js</a>, <a href="client.js.html#line337">line 337</a>
<a href="client.js.html">client.js</a>, <a href="client.js.html#line171">line 171</a>
</li></ul></dd>


Expand Down Expand Up @@ -808,7 +808,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="client.js.html">client.js</a>, <a href="client.js.html#line322">line 322</a>
<a href="client.js.html">client.js</a>, <a href="client.js.html#line156">line 156</a>
</li></ul></dd>


Expand Down Expand Up @@ -882,7 +882,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Client.ht
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Tue Jul 11 2023 09:39:58 GMT+0300 (East Africa Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Tue Jan 30 2024 14:26:49 GMT+0300 (East Africa Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
Loading
Loading