react-native-mobilefirst-wl-requests
This plugin supports for get,post,put,delete worklight requests on queryParams, formParams, jsonParams to mobilefirst adapters
Getting started
// First need to register the application in mobilefirst
$ npm install react-native-mobilefirst-wl-requests --save
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-mobilefirst-wl-requests
and addRNMobilefirstWlRequests.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNMobilefirstWlRequests.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Add pod 'IBMMobileFirstPlatformFoundation' to project's pod file
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactmfwllibrary.RNMobilefirstWlRequestsPackage;
to the imports at the top of the file - Add
new RNMobilefirstWlRequestsPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-mobilefirst-wl-requests' project(':react-native-mobilefirst-wl-requests').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-mobilefirst-wl-requests/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-mobilefirst-wl-requests') compile('com.ibm.mobile.foundation:ibmmobilefirstplatformfoundation:8.0.+') { exclude group: 'com.squareup.okio' }
Usage
; // TODO: What to do with the module?async { var values = name: 'James' age:25; var headerValues= token: '123456';try var result = await WLRequest; return result;catchereturn e;} async { var values = name: 'James' age:25; var headerValues= token: '123456';try var result = await WLRequest; return result;catchereturn e;}async { var values = name: 'James' age:25; var headerValues= token: '123456';try var result = await WLRequest; return result;catchereturn e;}