
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@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 58 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.