You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Besides passing options explicitly (see the root [README.me](../README.md) for
63
74
full description) you can use config files.
64
75
By default the tool will try to find `.gaarfrc` starting from the current folder
65
76
up to the root. If found, options from that file will be used if they weren't
66
77
supplied via command line.
67
78
68
79
Example of `.gaarfrc`:
80
+
69
81
```json
70
82
{
71
-
"ads-config": ".config/google-ads.yaml",
72
-
"output": "bq",
73
-
"csv.destination-folder": "output",
74
-
"macro": {
75
-
"start_date": "2022-01-01",
76
-
"end_date": "2022-02-10"
77
-
},
78
-
"account": 1234567890,
79
-
"bq.project": "myproject",
80
-
"bq.dataset": "mydataset",
81
-
"bq.dump-schema": true
83
+
"ads-config": ".config/google-ads.yaml",
84
+
"output": "bq",
85
+
"csv.destination-folder": "output",
86
+
"macro": {
87
+
"start_date": "2022-01-01",
88
+
"end_date": "2022-02-10"
89
+
},
90
+
"account": 1234567890,
91
+
"bq.project": "myproject",
92
+
"bq.dataset": "mydataset",
93
+
"bq.dump-schema": true
82
94
}
83
95
```
96
+
84
97
Please note that options with nested values, like 'bq.project', can be specified
85
98
either as objects (see "macro") or as flatten names ("bq.project").
86
99
@@ -91,6 +104,7 @@ file (as alternative to JSON) with a similar structure:
91
104
`gaarf <files> --config=gaarf.yaml`
92
105
93
106
Example of a yaml config:
107
+
94
108
```yaml
95
109
ads-config: .config/google-ads.yaml
96
110
output: bq
@@ -104,26 +118,30 @@ bq.dataset: mydataset
104
118
```
105
119
106
120
Similarly a config file can be provided for the gaarf-bq tool:
121
+
107
122
```
108
123
gaarf-bq bq-queries/*.sql --config=gaarf-bq.yaml
109
124
```
110
-
(again it can be either YAML or JSON)
111
125
126
+
(again it can be either YAML or JSON)
112
127
113
128
#### Ads API config
129
+
114
130
There are two mechanisms for supplying Ads API configuration (developer token, etc ).
115
131
Either via a separated yaml-file whose name is set in `ads-config` argument or
116
132
via separated CLI arguments starting `ads.*` (e.g. `--ads.client_id`) or
117
133
in a config file (`ads` object):
134
+
118
135
```json
119
136
{
120
-
"ads": {
121
-
"client_id": "...",
122
-
"developer_token": ".."
123
-
},
124
-
"output": "bq",
137
+
"ads": {
138
+
"client_id": "...",
139
+
"developer_token": ".."
140
+
},
141
+
"output": "bq"
125
142
}
126
143
```
144
+
127
145
Such a yaml-file is a standard way to configure Ads API Python client -
128
146
see [example](https://github.com/googleads/google-ads-python/blob/HEAD/google-ads.yaml).
129
147
@@ -132,25 +150,26 @@ search for a local file "google-ads.yaml" and if it exists it will be used.
132
150
133
151
See more help with `--help` option.
134
152
135
-
136
153
## Library
154
+
137
155
How to use Gaarf as a library in your own code.
138
156
First you need to create an instance of `GoogleAdsApiClient` which represents the Ads API
139
157
(it's a tiny wrapper around [Opteo/google-ads-api library](https://github.com/Opteo/google-ads-api) - open-source Ads API client for NodeJS).
140
158
141
159
> NOTE: there is no an official Ads API client for NodeJS from Google, but the Opteo's client
142
-
is a result of collaboration between Opteo and Google, so it's kinda a semi-official client.
160
+
> is a result of collaboration between Opteo and Google, so it's kinda a semi-official client.
143
161
144
162
`GoogleAdsApiClient` expects an object with Ads API access settings (TS-interface `GoogleAdsApiConfig`).
145
163
You can construct it manually or load from a yaml or json file (e.g. google-ads.yaml)
0 commit comments