client wrapper
Allows easier communication with the APM service.
Usage
const clientWrapper = ; const baseUrl = 'http://localhost:8080' const client =
Note
Before we continue. There are a few things that are important to mention.
- The API acts as a proxy for requests through to APM.
- A response via callback or async/await got cycle.
Profiles
-
CreateNewProfile
This method creates a profile.
const client =const profile = await clientThe
profile object
above should contain the following properties. i.e.external_platform_domain: string // Requiredaccess_token: string // Requiredexternal_shop_id: string // Requiredemail: string // Requiredbusiness_id: ObjectId // Requiredplatform: string // Current only available options 'shopify'business_name: string // OptionalThe response body should contain the following properties. Response Body
-
fetchProfileById
This method fetches a profile by id provided.
const client =const profile = await clientThe response body should contain the following properties. Response Body
-
toggleProfileStatus
This method changes the activation/deactivation status of a given profile.
const client =const toggleStatus = await client// 'A' for activated and 'D' for deactivatedThe response body should contain the following properties. Response Body
Businesses
-
getProfilesByBusinessId
This fetches profiles related to a given business using the
business_id
field.const client =const profile = await clientThe response body should contain the following properties. Response Body
Errors
Any response errors that occur will be in the following formats
- Profile does not exist error
- Profile already exists error
- Validation error
- Internal server error