@inyourarea/profile-service
v0.1.4
Published
HTTP Client and API for profile-service api
Downloads
6
Readme
Profile Service Client
Introduction
A helper client to call the profile service api
For example usage see profile-service
Usage
import axios from 'axios'
import getSig from './getSig' // Generate backendSig
import { createProfileService, createApi, createClient } from '@inyourarea/profile-service
// Create API with the default client
const service = createProfileService({
agent: 'my-service',
env: process.env.ENV,
auth: () => getSig()
});
const iyaProfile = await service.iya.user('someIid').profile.get()
const getMlProfile = (userIid, key) =>
service.memorylane.user(userIid).profile.get({ auth: `Bearer ${key}`})
const client = createClient({agent: 'my-service', env: process.env.ENV })
const { data } = await client.get('/v1/iya/user/someIid/profile')
// Create API with a custom axios client
const api = createApi(axios.create({ baseURL: 'http://localhost:8080'}))
const { firstName, lastName } =
await api.memorylane.user('someIid').profile.get({ config: { timeout: 3000 }})
Releasing
If you want to release this package, then you will need to version it by running npm version <major|minor|patch>
and then raise a PR to be merged into the master branch.
Remember that ANY breaking change MUST be considered major, unless the package version is below v1.0.0, in this case feel free to bump minor version. If the package obtains mass adoption, then we can consider releasing v1.0.0 which gives more flexibility in versioning.