Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
@bonniernews/bn-google-ad-manager-api
Advanced tools
This repo is a fork of https://github.com/thewizarodofoz/google-ad-manager-api to update dependencies, functionality and add typing for the different gam services.
This repo is a fork of https://github.com/thewizarodofoz/google-ad-manager-api to update dependencies, functionality and add typing for the different gam services.
We have tried to keep the overall structure intact, but we moved the authorization to its own step for readability reasons. Checkout Step #2 for the change and Step #3 for code removal.
A modern wrapper around Google's Ad Manager API.
npm i @BonnierNews/bn-google-ad-manager-api
Obtain an access token in whatever way you like, for example using Google Auth Library's JSON Web Tokens mechanism:
const { auth } = require("google-auth-library");
const keys = {
type: "service_account",
project_id: "...",
private_key_id: "...",
private_key: "...",
client_email: "...",
client_id: "...",
auth_uri: "https://accounts.google.com/o/oauth2/auth",
token_uri: "https://oauth2.googleapis.com/token",
auth_provider_x509_cert_url: "https://www.googleapis.com/oauth2/v1/certs",
client_x509_cert_url: "...",
};
const client = auth.fromJSON(keys);
client.scopes = ["https://www.googleapis.com/auth/dfp"];
await client.authorize();
Create a client and authorize it with the google auth credentials token from step #1:
import { DFPClient, GAMClient } from "@BonnierNews/bn-google-ad-manager-api";
// To maintain backwards compatability we keep the DFP client intact with the option to use our own client.
// Both have the same functions
const dfpClient = new DFPClient();
await dfpClient.authorize({ networkCode: "...", apiVersion: "v201805", accessToken: client.credentials.access_token });
// or with gamClient
const gamClient = new GAMClient();
await gamClient.authorize({ networkCode: "...", apiVersion: "v201805", accessToken: client.credentials.access_token });
Use the client to create a service.
const lineItemService = await dfpClient.getService("LineItemService");
// or
const lineItemService = await gamClient.getService("LineItemService");
Invoke service methods:
const res = await lineItemService.getLineItemsByStatement({
filterStatement: {
query: "WHERE name LIKE 'prebid%'",
},
});
console.log(res.results[0].id);
rval
field for each method invocation.
To make things easier for us, this package will return the content of that field.
For example, invocation of LineItemService.getLineItemsByStatement
will return a LineItemPage
object directly.service.setToken
.FAQs
This repo is a fork of https://github.com/thewizarodofoz/google-ad-manager-api to update dependencies, functionality and add typing for the different gam services.
The npm package @bonniernews/bn-google-ad-manager-api receives a total of 16 weekly downloads. As such, @bonniernews/bn-google-ad-manager-api popularity was classified as not popular.
We found that @bonniernews/bn-google-ad-manager-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 32 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.