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

odc-api

v1.3.1

Published

API that simplifies working with the WPP ODC platform

Downloads

4

Readme

odc-api

An API that simplifies working with the WPP ODC platform. It's still a W.I.P., so not all functionality from the ODC platform is included. Note that this library is not officially supported by the ODC development team. Before using this in a case, discuss what you're up to with the development team so you know for sure the platform will be able to handle it. This library is using the Front End API, so it might not be suitable for large quantities of data.

In case you're missing some functionality, contact [email protected] for more information.

Example 1: Create Context Rule

import ODCAuthClient, { Adset, predicateHelper } from "../src/index";

(async () => {
  try {
    const authClient = new ODCAuthClient({
      email: process.env.EMAIL,
      password: process.env.PASSWORD,
    });
    const adset = new Adset(authClient, 1234);
    await adset.syncContent("draft");

    adset.addContextRule({
      predicate: predicateHelper.create("id", "=", "1234"),
      assignments: [{ name: "title", expr: "A new Title for this ID" }],
    });

    await adset.saveChanges();
  } catch (e) {
    console.log(e);
  }
})();

Structure

Classes

ODC

Client class that handles authentication and requests.

Usage:

const authClient = new ODCAuthClient({
  email: EMAIL<String>,
  password: PASSWORD<String>,
});

Exposes three different methods:

  • GET
  • POST
  • UPDATE

Switch to another agency

When your account has access to multiple agencies, you should explicitely switch to that agency.

Usage:

authclient.switchAgency(1);

Please note that it's a best practise to create a dedicated account for API usage.

Entitites

Adset

Class for updating an Adset. Not yet supporting the creation of adsets dynamically.

Usage:

new Adset(odcClient <ODCAuthClient>, adsetId <Number>);

AdsetService

Service that wraps multiple functions of the Adset entity, making it easier to use. For example, when creating a Context Rule, you don't have to manually sync the adset content and save the changes afterwards.

Usage:

const adsetService = new AdsetService(odcClient <ODCAuthClient>);
await adsetService.addContextRules(adsetId: <Number>, rules: <ContextRule[]>);