Skip to content

Commit

Permalink
doc: extends example in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-scherzinger committed May 30, 2017
1 parent 0082c97 commit a85119b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 6 additions & 2 deletions README.md
Expand Up @@ -38,7 +38,12 @@ dataManager.setToken(accessToken);

dataManager.dataManagerList()
.then(list => doSomthingWith(list))
.catch(console.log);
.catch(console.error);

const accounts = new Accounts(); // This uses 'live' environment
accounts.me() // This has token from 'dataManager'
.then(me => show(me))
.catch(console.error)
```

##### Node
Expand All @@ -57,7 +62,6 @@ dataManager.dataManagerList()
> This is not officially supported. Mainly exists for usage in jsfiddles or similar.
```html
<!-- Good Luck :D - We have a browserified build in ./dist/ -->
<script src="https://unpkg.com/ec.sdk/dist/ec.sdk.min.js"></script>
<script>
console.log('My development stack is bad and I should feel bad');
Expand Down
5 changes: 3 additions & 2 deletions src/doc/1-introduction.md
Expand Up @@ -8,7 +8,7 @@ In order to use this SDK you should be familiar with ec.APIs and the concepts be

For every ec.API you will find an API connector. Use one of those to connect to a certain ec.API. Login and logout are special cases and are done in [Session](#Session) API connector.

All API connectors of a certain [environment](#environment) share some information. The most important one is any access token either received with [Session#login](#Session#login) or by calling [Core#setToken](#Core#setToken). This means you can specifiy the token on any API connector and it will be automatically used by all other API connectors. If any API connector will receives a token related Error ([Problem](#Problem)) it will be automatically removed from all API connectors and a [logout event](#eventeventlogout) is fired.
All API connectors of a certain [environment](#environment) share some information. The most important one is any access token either received with [Session#login](#Session#login) or by calling [Core#setToken](#Core#setToken). This means you can specifiy the token on any API connector and it will be automatically used by all other API connectors. If any API connector will receives a token related Error ([Problem](#Problem)) it will be automatically removed from all API connectors and a [logout event](#eventeventlogout) is triggered.

Every action you take in the ec.sdk will be validated before it will send as a request to ec.APIs. This means that the provided json schemas are used.

Expand All @@ -20,7 +20,7 @@ import { Session, Accounts, DataManager } from 'ec.sdk';
import { AccountResource } from 'ec.sdk/typings/resources/AccountResource';
import { DataManagerResource } from 'ec.sdk/typings/resources/DataManagerResource';

class myExample {
class MyExample {
session: Session;
accounts: Accounts;
dataManager: DataManager;
Expand Down Expand Up @@ -69,3 +69,4 @@ class myExample {
}
}
```

0 comments on commit a85119b

Please sign in to comment.