@promobase/google-ads-sdk 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +90 -0
  2. package/package.json +2 -3
package/README.md ADDED
@@ -0,0 +1,90 @@
1
+ <div align="center">
2
+
3
+ <a href="https://openpromo.app">
4
+ <img src="https://openpromo.app/logo.svg" width="80" alt="openpromo" />
5
+ </a>
6
+
7
+ # @promobase/google-ads-sdk
8
+
9
+ **Type-safe TypeScript SDK for the Google Ads API v23 — generated from protobuf, with a typed GAQL query builder.**
10
+
11
+ Powering [**openpromo.app**](https://openpromo.app) — the AI-native social media workspace.
12
+
13
+ [![npm](https://img.shields.io/npm/v/@promobase/google-ads-sdk.svg?label=%40promobase%2Fgoogle-ads-sdk)](https://www.npmjs.com/package/@promobase/google-ads-sdk)
14
+ [![License](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
15
+
16
+ </div>
17
+
18
+ ---
19
+
20
+ ## What
21
+
22
+ A fetch-based, runtime-agnostic Google Ads v23 client generated from the official protos. 184 resource types, 111 services, 543 enums, 235 metric fields, 132 segment fields — all typed. Plus a customer-bound factory for campaign lifecycle flows and a typed GAQL query builder with field-literal autocomplete and row-level narrowing.
23
+
24
+ ## Install
25
+
26
+ ```bash
27
+ bun add @promobase/google-ads-sdk
28
+ # or
29
+ npm install @promobase/google-ads-sdk
30
+ ```
31
+
32
+ ## Use
33
+
34
+ ```ts
35
+ import { Google } from "@promobase/google-ads-sdk";
36
+
37
+ const client = Google.createClient({
38
+ getAccessToken: async () => db.getGoogleToken(userId),
39
+ developerToken: process.env.GOOGLE_ADS_DEV_TOKEN!,
40
+ loginCustomerId: "1234567890",
41
+ });
42
+ const customer = Google.Ads.customer(client, "9999999999");
43
+
44
+ // Campaign lifecycle — rich refs chain automatically
45
+ const budget = await customer.campaignBudgets.create({
46
+ name: "Q1",
47
+ amountMicros: "5000000",
48
+ });
49
+
50
+ const campaign = await customer.campaigns.create({
51
+ name: "Search Q1",
52
+ status: "PAUSED",
53
+ advertisingChannelType: "SEARCH",
54
+ campaignBudget: budget, // rich ref, auto-resolved
55
+ });
56
+
57
+ const adGroup = await customer.adGroups.create({
58
+ name: "Shoes",
59
+ status: "ENABLED",
60
+ type: "SEARCH_STANDARD",
61
+ campaign, // same pattern
62
+ });
63
+
64
+ // Typed GAQL — full autocomplete, narrowed row shape
65
+ const { rows } = await customer.gaql
66
+ .from("campaign")
67
+ .select("campaign.id", "campaign.name", "metrics.clicks")
68
+ .where("campaign.status = 'ENABLED'")
69
+ .limit(100)
70
+ .execute();
71
+
72
+ // rows: Array<{ campaign: { id: string; name: string }; metrics: { clicks: string } }>
73
+ ```
74
+
75
+ ## Features
76
+
77
+ - **184 resource types, 111 services** — generated from pinned v23 protos
78
+ - **Typed GAQL builder** — `.from().select(...).where().limit().execute()` with deep row narrowing
79
+ - **Customer-bound factory** — `customer.campaigns.create(...)`, `customer.adGroups.create(...)`, rich refs
80
+ - **Proper error surface** — `GoogleAdsError` parses nested `GoogleAdsFailure` details + request ID
81
+ - **Runtime agnostic** — native `fetch`, pluggable OAuth via `getAccessToken` callback
82
+ - **Pagination** — async iterables via `customer.gaql.from(...).stream()` and raw `Google.Ads.paginate()`
83
+
84
+ ## Umbrella package
85
+
86
+ For a single install covering Meta + TikTok + Google Ads, use [`@promobase/ad-platforms`](https://www.npmjs.com/package/@promobase/ad-platforms).
87
+
88
+ ## License
89
+
90
+ MIT © [Promobase](https://openpromo.app)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promobase/google-ads-sdk",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "Type-safe Google Ads API v23 SDK, runtime-agnostic, generated from protobuf. Customer-bound factory and typed GAQL query builder.",
5
5
  "keywords": [
6
6
  "google-ads",
@@ -46,8 +46,7 @@
46
46
  "scripts": {
47
47
  "codegen": "bun run src/codegen/index.ts",
48
48
  "typecheck": "tsc --noEmit",
49
- "test": "bun test tests/",
50
- "publish": "bun publish --access public"
49
+ "test": "bun test tests/"
51
50
  },
52
51
  "publishConfig": {
53
52
  "access": "public"