|
1 |
| -# googleads-node-lib |
| 1 | +<p align="center"> |
| 2 | + <a href="https://developers.google.com/ad-manager/api/start" target="blank"><img src="https://developers.google.com/ads/images/logo_admanager_192px.svg" width="120" alt="Ad Manager Logo" /></a> |
| 3 | +</p> |
| 4 | + |
| 5 | +[circleci-image]: https://img.shields.io/circleci/build/github/Niurmiguel/google-admanager-api/master?token=abc123def456 |
| 6 | +[circleci-url]: https://circleci.com/gh/Niurmiguel/google-admanager-api |
| 7 | + |
| 8 | + <p align="center"><a href="https://developers.google.com/ad-manager/api/start" target="_blank">Google Ad Manager API</a> Client Library for NodeJs.</p> |
| 9 | + <p align="center"> |
| 10 | +<a href="https://www.npmjs.com/~niur" target="_blank"><img src="https://img.shields.io/npm/v/@niur/google-admanager-node-lib.svg" alt="NPM Version" /></a> |
| 11 | +<a href="https://www.npmjs.com/~niur" target="_blank"><img src="https://img.shields.io/npm/l/@niur/google-admanager-node-lib.svg" alt="Package License" /></a> |
| 12 | +<a href="https://www.npmjs.com/~niur" target="_blank"><img src="https://img.shields.io/npm/dm/@niur/google-admanager-node-lib.svg" alt="NPM Downloads" /></a> |
| 13 | +</p> |
| 14 | + |
| 15 | +## Description |
| 16 | + |
| 17 | +Developers can use the Google Ad Manager API to build applications that manage inventory, create orders, pull reports, and more. |
| 18 | + |
| 19 | +### Installing the library |
| 20 | + |
| 21 | +```bash |
| 22 | +$ npm install @niur/google-admanager-node-lib |
| 23 | +``` |
| 24 | +### Overview |
| 25 | + |
| 26 | +#### Authentication |
| 27 | + |
| 28 | +All Google Ad Manager API calls must be authorized through OAuth2 an open standard that allows users to grant permissions to third-party applications, so the application can interact with web services on the user's behalf. OAuth2 enables your Ad Manager API client application to access a user's Ad Manager account without having to handle or store the user's username or password. |
| 29 | + |
| 30 | +##### Generate OAuth2 credentials |
| 31 | + |
| 32 | +```typescript |
| 33 | + |
| 34 | +const credential = new GoogleSACredential({ |
| 35 | + "type": "service_account", |
| 36 | + "project_id": "...", |
| 37 | + "private_key_id": "...", |
| 38 | + "private_key": "...", |
| 39 | + "client_email": "...", |
| 40 | + "client_id": "...", |
| 41 | + "auth_uri": "...", |
| 42 | + "token_uri": "...", |
| 43 | + ... |
| 44 | +}, ['ad_manager']); |
| 45 | + |
| 46 | +//or |
| 47 | + |
| 48 | +const credential = new GoogleSAFileCredential('./credentials.json', ['ad_manager']); |
| 49 | + |
| 50 | +``` |
| 51 | + |
| 52 | +##### Use a client library |
| 53 | + |
| 54 | +```typescript |
| 55 | + |
| 56 | +const adManagerClient = new AdManagerClient('network code',credential,'application name'); |
| 57 | + |
| 58 | +const orderService = await adManagerClient.getService("OrderService"); |
| 59 | +const statement = new StatementBuilder().limit(10); |
| 60 | +const orderPage = await orderService.getOrdersByStatement(statement.toStatement()) |
| 61 | + |
| 62 | +/** |
| 63 | + * { |
| 64 | + * results: [], |
| 65 | + * totalResultSetSize: 0, |
| 66 | + * startIndex: 0 |
| 67 | + * } |
| 68 | + * / |
| 69 | +``` |
| 70 | +
|
| 71 | +##### Options |
| 72 | +
|
| 73 | +<table> |
| 74 | + <tr> |
| 75 | + <td><code><b>networkCode</b></code></td> |
| 76 | + <td><code>Number</code></td> |
| 77 | + <td>The network code of the network being addressed (<b>required</b>).</td> |
| 78 | + </tr> |
| 79 | + <tr> |
| 80 | + <td><code><b>credential</b></code></td> |
| 81 | + <td><code>SACredential</code></td> |
| 82 | + <td>OAuth2 credential (<b>required</b>).</td> |
| 83 | + </tr> |
| 84 | + <tr> |
| 85 | + <td><code><b>applicationName</b></code></td> |
| 86 | + <td><code>String</code></td> |
| 87 | + <td>An arbitrary string name identifying your application. This will be shown in Google's log files. For example: "My Inventory Application" or "App_1" (<b>optional</b>).</td> |
| 88 | + </tr> |
| 89 | +</table> |
| 90 | +
|
| 91 | +## Stay in touch |
| 92 | +
|
| 93 | +* Author - [Niurmiguel](https://github.com/Niurmiguel) |
| 94 | +
|
| 95 | +## License |
| 96 | +Nestjs Azure Service Bus is [MIT licensed](LICENSE). |
0 commit comments