Giter VIP home page Giter VIP logo

wg-public-api's Introduction

This project is ARCHIVED

CRUD wrapper around WG Public API

Usage

const client = new WgClient(`YOUR KEY`);

make client you want to use

const metrics = client.metrics();

// create
const metric = await metrics.post({
	external_id: 'impressions',
	name: 'Product impressions',
	type: 'int',
	negative_ratio: false,
	options: {
		accumulator: 'sum',
	},
});


await metrics.index();
const metricIndex = await metrics.index(
	{
		page: 2,
		per_page: 1,
	},
	{
		field: 'id',
		direction: 'desc',
	},
	{
		impressions: '18310', // TODO greater/less than or equal to
	},
);

metricIndex.data // to access metric list 


await metrics.update (123, {
	name: 'impressions',
	external_id: 'impressions',
	negative_ratio: true,
	type: 'int',
	options: {
		accumulator: 'sum',
	},
});

Dimensions

const dimensions = client.dimensions ();

await dimensions.index(); 
await dimensions.index(
	{
		page: 2,
		per_page: 1,
	},
	{
		field: 'id',
		direction: 'desc',
	},
	{
		device_size: 'small',
	},
);

const dimension = await dimensions.create({
	external_id: 'device_size',
	name: 'Device size',
	type: 'string',
})

const updatedDimension = await dimensions.update(3815, {
	external_id: 'block_size',
	name: 'Block size',
	type: 'string',
});

// delete
await dimensions.delete(3815);

Integration source data point.

const integrationData = client.integrationSourceDataPoints();

await integrationData.index();

await integrationData.create({
	date: '2020-01-20',
	integration_data: {
		// your data in json for a single day. must include 'date' key
		date: '2020-01-20',
	},
});

await integrationData.update('AASF123', {
	date: '2020-01-20',
	integration_data: {
		impressions: '1000000',
		clicks_per_post: '10000',
		date: '2020-01-20',
	},
});


await integrationData.delete('AASF123');

wg-public-api's People

Contributors

kscerbiakas avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.