-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(package): upgrade logger and add detailed readme
EME-5329 Co-authored-by: Gabor Nemeth <gabor.nemeth@emarsys.com>
- Loading branch information
Showing
4 changed files
with
34 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,45 @@ | ||
# Escher Suite API client for JavaScript | ||
[![Dependency Status](https://david-dm.org/emartech/escher-suiteapi-js.svg)](https://david-dm.org/emartech/escher-suiteapi-js) | ||
[![devDependency Status](https://david-dm.org/emartech/escher-suiteapi-js/dev-status.svg)](https://david-dm.org/emartech/escher-suiteapi-js#info=devDependencies) | ||
# @emartech/escher-request | ||
|
||
## Usage | ||
|
||
### Javascript | ||
|
||
```javascript | ||
const SuiteRequest = require('escher-suiteapi-js'); | ||
const { EscherRequest, EscherRequestOption } = require('@emartech/escher-request'); | ||
|
||
const options = new EscherRequestOption('example.host.com', { | ||
credentialScope: 'eu/service/ems_request' | ||
}); | ||
const request = EscherRequest.create('escher.key', 'escher.secret', options); | ||
|
||
const heroId = 1; | ||
const hero = await request.get(`/heroes/${heroId}`); | ||
console.log(hero); | ||
|
||
const heroes = await request.post('/heroes', { | ||
name: 'Captain America', | ||
sex: 'male' | ||
}); | ||
console.log(heroes); | ||
``` | ||
|
||
### Typescript | ||
|
||
```typescript | ||
const { EscherRequest, EscherRequestOption } = require('@emartech/escher-request'); | ||
|
||
const options = new SuiteRequest.Options('example.host.com', { | ||
const options = new EscherRequestOption('example.host.com', { | ||
credentialScope: 'eu/service/ems_request' | ||
}); | ||
const suiteRequest = SuiteRequest.create('escher.key', 'escher.secret', options); | ||
const request = EscherRequest.create('escher.key', 'escher.secret', options); | ||
|
||
const heroId = 1; | ||
let response = await suiteRequest.get(`/heroes/${heroId}`); | ||
console.log(response); | ||
const hero = await request.get<{ name: string; }>(`/heroes/${heroId}`); | ||
console.log(hero); | ||
|
||
let response = await suiteRequest.post('/heroes', { | ||
const heroes = await request.post<{ name: string; }[]>('/heroes', { | ||
name: 'Captain America', | ||
sex: 'male' | ||
}); | ||
console.log(response); | ||
console.log(heroes); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters