Skip to content

Commit daf5d0a

Browse files
docs: add Bid Manager API documentation
* Add fetcher overview page * Mention Bid Manager API in README
1 parent 01b1c6d commit daf5d0a

File tree

4 files changed

+86
-0
lines changed

4 files changed

+86
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ and writes it virtually anywhere.
2525
* [YouTube Reporting API](https://google.github.io/garf/fetchers/youtube-reporting-api/)
2626
* [Google Analytics](https://google.github.io/garf/fetchers/google-analytics-api/)
2727
* [Google Merchant Center](https://google.github.io/garf/fetchers/merchant-center-api/)
28+
* [Bid Manager](https://google.github.io/garf/fetchers/bid-manager/)
2829

2930

3031
## Installation

docs/fetchers/bid-manager.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
## garf for Bid Manager API
2+
3+
Interacts with [Bid Manager API](https://developers.google.com/bid-manager).
4+
5+
## Install
6+
7+
Install `garf-bid-manager` library
8+
9+
/// tab | pip
10+
```
11+
pip install garf-executors garf-bid-manager
12+
```
13+
///
14+
15+
/// tab | uv
16+
```
17+
uv pip install garf-executors garf-bid-manager
18+
```
19+
///
20+
21+
## Usage
22+
23+
### Prerequisites
24+
25+
* [Bid Manager API](https://console.cloud.google.com/apis/library/analytics.googleapis.com) enabled.
26+
* [Credentials](https://developers.google.com/bid-manager/guides/get-started/generate-credentials) configured, can be exposed as `GARF_BID_MANAGER_CREDENTIALS_FILE` ENV variable
27+
28+
/// tab | cli
29+
```bash
30+
echo """
31+
SELECT
32+
advertiser,
33+
metric_clicks AS clicks
34+
FROM standard
35+
WHERE advertiser = 1
36+
AND dataRange = LAST_7_DAYS
37+
" > query.sql
38+
garf query.sql --source bid-manager \
39+
--output csv
40+
```
41+
///
42+
43+
/// tab | python
44+
45+
```python
46+
import os
47+
48+
from garf_io import writer
49+
from garf_bid_manager import BidManagerApiReportFetcher
50+
51+
query = """
52+
SELECT
53+
advertiser,
54+
metric_clicks AS clicks
55+
FROM standard
56+
WHERE advertiser = 1
57+
AND dataRange = LAST_7_DAYS
58+
"""
59+
60+
fetched_report = (
61+
BidManagerApiReportFetcher(
62+
credentials_file=os.getenv('GARF_BID_MANAGER_CREDENTIALS_FILE')
63+
)
64+
.fetch(query)
65+
)
66+
67+
csv_writer = writer.create_writer('csv')
68+
csv_writer.write(fetched_report, 'query')
69+
```
70+
///
71+
72+
### Available source parameters
73+
74+
| name | values| comments |
75+
|----- | ----- | -------- |
76+
| `credentials_file` | File with Oauth or service account credentials | You can expose `credentials_file` as `GARF_BID_MANAGER_CREDENTIALS_FILE` ENV variable|

docs/fetchers/overview.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Supported APIs
2+
3+
* [YouTube Data API](youtube-data-api.md)
4+
* [YouTube Reporting API](youtube-reporting-api.md)
5+
* [Google Analytics](google-analytics-api.md)
6+
* [Google Merchant Center](merchant-center-api.md)
7+
* [Bid Manager](bid-manager.md)

mkdocs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,10 @@ nav:
7373
- Create API response parser: development/create-api-response-parser.md
7474
- Create a library: development/create-garf-library.md
7575
- Fetchers:
76+
- fetchers/overview.md
7677
- YouTube:
7778
- Data API: fetchers/youtube-data-api.md
7879
- Reporting API: fetchers/youtube-reporting-api.md
7980
- Merchant Center: fetchers/merchant-center-api.md
8081
- Google Analytics: fetchers/google-analytics-api.md
82+
- Bid Manager: fetchers/bid-manager.md

0 commit comments

Comments
 (0)