Request facade used by Alpaka React Native apps.
Using npm:
npm install --save @alpakaio/alpaka-native-request
import UserAgent from '@alpakaio/alpaka-native-request';
Method | Return Type | iOS | Android | Windows | Since |
---|---|---|---|---|---|
createRequest(tenant, [token]) | Promise<Request> |
✅ | ✅ | ✅ | 1.0.0 |
createInstance() | Promise<Request> |
✅ | ✅ | ✅ | 1.0.0 |
Creates or gets a current axios instance configured to communicate with the Alpaka API
Examples
const request = await createRequest('test');
const response = request.get('version');
console.log(response.data.version);
createRequest((request) => (request.get('version'))).then((response) => {
console.log(response.data.version);
});
Creates an axios instance with an Alpaka user agent assigned
Examples
const axios = await createInstance();
const response = axios.get('https://alpaka.alpaka.io/api/v3/version');
console.log(response.data.version);
createInstance((axios) => (axios.get('https://alpaka.alpaka.io/api/v3/version'))).then((response) => {
console.log(response.data.version);
});
See the CHANGELOG.md.