npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dacwinapi

v1.3.1

Published

This package makes it easy to manage information about your DacWin referral system.

Downloads

10

Readme

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))