https://github.com/emartech/escher-suiteapi-js
Escher request library for Escher authenticated API clients
https://github.com/emartech/escher-suiteapi-js
escherauth javascript node-js node-module nodejs
Last synced: 8 months ago
JSON representation
Escher request library for Escher authenticated API clients
- Host: GitHub
- URL: https://github.com/emartech/escher-suiteapi-js
- Owner: emartech
- License: mit
- Created: 2014-11-12T12:45:06.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2025-08-10T15:52:29.000Z (10 months ago)
- Last Synced: 2025-08-12T23:22:03.285Z (10 months ago)
- Topics: escherauth, javascript, node-js, node-module, nodejs
- Language: TypeScript
- Homepage:
- Size: 767 KB
- Stars: 5
- Watchers: 15
- Forks: 20
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# @emartech/escher-request
## Usage
### Javascript
```javascript
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
import { EscherRequest, EscherRequestOption } from '@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<{ name: string; }>(`/heroes/${heroId}`);
console.log(hero);
const heroes = await request.post<{ name: string; }[]>('/heroes', {
name: 'Captain America',
sex: 'male'
});
console.log(heroes);
```
### Retry
You can specify an optional retry config in the constructor of the EscherRequestOption's second parameter:
```typescript
const options = new EscherRequestOption('example.host.com', {
credentialScope: 'eu/service/ems_request',
retryConfig: {
retries: 5
}
});
```
The type of the `retryConfig` property is `IAxiosRetryConfig`, you can find the detailed list of available parameters here: https://github.com/softonic/axios-retry#options