21.3.0 • Published 6 months ago
@emartech/escher-request v21.3.0
@emartech/escher-request
Usage
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
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:
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
21.2.0
7 months ago
21.1.3
10 months ago
21.3.0
6 months ago
21.1.2
10 months ago
21.1.5
7 months ago
21.1.4
7 months ago
21.1.6
7 months ago
21.1.1
1 year ago
21.1.0
1 year ago
21.0.0
2 years ago
20.3.0
2 years ago
20.2.1
2 years ago
20.1.0
3 years ago
20.0.0
3 years ago
20.2.0
3 years ago
19.0.0
3 years ago
18.0.2
3 years ago
18.0.1
3 years ago
18.0.0
3 years ago