fetch-salesforce
is a wrapper for the Salesforce.com REST API using the Fetch API. This library was initially developed to be used in React Native projects that needed to access the Salesforce API, but it can be used in any environment that supports fetch
.
yarn add fetch-salesforce
import { SalesforceOptions, FetchSalesforce } from 'fetch-salesforce';
const options: any = {
clientID: '',
authorizationServiceURL: '',
tokenServiceURL: '',
redirectUri: '',
apiVersion: 39.0,
logLevel: 'DEBUG',
}
const fetchSalesforce = new FetchSalesforce(options);
fetchSalesforce.fetchSObject.insert('Account', {
Name: 'My Account'
})
.then((res) => {
console.log(res);
});
fetchSalesforce.fetchQuery.query('SELECT ID FROM Account LIMIT 10')
.then((res) => {
console.log(res);
});
... you get the idea!
git clone https://github.com/kidtsunami/fetch-salesforce
cd fetch-salesforce
tsc
yarn test