1.3.1 • Published 6 months ago

dacwinapi v1.3.1

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

DacWin API

The JavaScript package dacwinapi makes it easy to manage information about your DacWin referral system. This package is specifically designed to interact with the DacWin API and allows you to manage information about an application's users, referral campaigns, rewards and events.

DacWin home page: https://referral-dev.dactechnologies.net

Installation

To install dacwinapi, you can use npm:

npm install dacwinapi

Before using this package you must have the API key of the application you want to manage. If this is not the case yet,

  • Go to your customer area: https://referral-devuser.dactechnologies.net
  • In the Applications section: - Add an application and copy the generated API key. - Or, open your application's edit window and regenerate a new API key if you no longer have the old one.

How to use this package

1. Campaigns

import { CampaignService } from "dacwinapi"

// create an instance of CampaignService
const campaignService = new CampaignService("your_app_api_key")

// retrieve the list of campaigns of the app
console.log(await campaignService.getAll())

// retrieve one campaign data
console.log(await campaignService.getOne(18)) // 18 is the campaign id

NOTE: Creating a campaign is only done on your DacWin customer interface.

2. App users

import { AppUserService } from "dacwinapi"

// create an instance of AppUserService
const appUserService = new AppUserService("your_app_api_key")

// add new app user with referral information
const app_user_created = await appUserService.create({
	reference: "3ddd",
	referrer_referral_code: "AAAAA"
})

console.log(app_user_created)

// retrieve the list of app users of the app
console.log(await appUserService.getAll())

// retieve one app user by her id
console.log(await appUserService.getOneById(2)) // 2 is the app user id

// retieve one app user by her reference
console.log(await appUserService.getOneByReference("1Pxdd6tH3")) // "1Pxdd6tH3" is the app user reference

3. Events

import { EventService } from "dacwinapi"

// create an instance of EventService
const eventService = new EventService("your_app_api_key")

// add a new event for specific app user and campaign
const event_created = await eventService.create({
	name: "ddd",
	campaign_id: 18,
	app_user_id: 14
})

console.log(event_created)

// retrieve the list of events of the app
console.log(await eventService.getAll())

// retrieve the list of app's events of specific campaign
console.log(await eventService.getAll({ campaign_id: 18 }))

// retrieve one event
console.log(await eventService.getOne(12)) // 12 is the event id

4. Rewards

import { RewardService } from "dacwinapi"

// create an instance of RewardService
const rewardService = new RewardService("your_app_api_key")

// retrieve the list of rewards of the app
console.log(await rewardService.getAll())

// retrieve the list of app's rewards of specific campaign
console.log(await rewardService.getAll({ campaign_id: 18 }))

// retrieve one reward
console.log(await rewardService.getOne(12))
1.3.1

6 months ago

1.3.0

6 months ago

1.2.1

7 months ago

1.2.0

7 months ago

1.1.0

7 months ago

1.0.0

7 months ago