- SDK will have interfaces defined for all request object and api calls
- ex. investor request, mf_purchase request etc
- ex. for api call. Fp.Investor.create(), Fp.Investor.fetch(:id)
- ex. investor request, mf_purchase request etc
- We cann't put type definition in the response as typescript currently doesn't supports it.
- Developers who uses our interface can detect error if any during compilation itself.
- SDK will return the following,
- JSON data for 2xx responses
- Throw error for non 2xx responses (WIP)
-
- Supports Authentication via PKCE flow using
oidc-client-ts
package. - Has wrapper built over
FP apis
- install the package using any of the ways below
- using cli,
- From terminal run
npm i @fintechprimitives/fpapi
- From terminal run
- using cli,
- To pull the latest changes after pushing this branch to master,
run `npm upgrade @fintechprimitives/fpapi`
// create in the root component so that only one instance exists and pass it around using props. import { AuthService } from '@fintechprimitives/fpapi'; const fpAuthService = new AuthService({ authority: <URL>, // identity provider url clientId: <client_id>, // client id associated redirectUri: <uri>, // redirect uri for KC to call after authentication, // a route needs to be present to handle. postLogoutRedirectUri: <uri>, // redirect uri for KC to call after logout });
Need to intialise the config object with the base-url, then make calls to respective api's. Make sure you have a valid token before and recreate the client if the token is expired.
The resources can be accessed via this instance.
Every resource method returns a promise.
const investorResp = await fpClient.investor().fetch(1);
import { fp } from '@fintechprimitives/fpapi'; let options = { hostUrl: 'https://s.finprim.com/', token: '{{generated_token}}', }; const fpClient = new fp(options); // using as async / await try { const data = await fpClient.investor().fetch(663); console.log('data', data); } catch(e: any) { console.log('error', e); } // using as promises fpClient.investor().fetch(663) .then(data => { console.log(data); }) .catch(e => console.log(e));
- To test local use while developing, use src/testing.ts file
- run
$ npx ts-node testing.ts
- Supports Authentication via PKCE flow using