Skip to content

Commit e79dcbc

Browse files
committed
feat: add documentation for Sponsored Brands Themes API
- Add comprehensive documentation for Themes API in themes.rst - Include examples for list_themes, create_themes, and update_themes endpoints - Reference the new documentation in sb_v3.rst
1 parent 9c4a7f6 commit e79dcbc

File tree

2 files changed

+107
-0
lines changed

2 files changed

+107
-0
lines changed

docs/sb/themes.rst

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
Themes
2+
======
3+
4+
.. autoclass:: ad_api.api.sb.Themes
5+
6+
.. autofunction:: ad_api.api.sb.Themes.list_themes
7+
8+
### Example Python
9+
10+
.. code-block:: python
11+
12+
from ad_api.api.sb.themes import Themes
13+
14+
result = Themes().list_themes()
15+
print(result)
16+
17+
.. autofunction:: ad_api.api.sb.Themes.create_themes
18+
19+
### Example Python
20+
21+
.. code-block:: python
22+
23+
from ad_api.api.sb.themes import Themes
24+
import json
25+
26+
# Example data for themes
27+
themes_to_create = [
28+
{
29+
"adGroupId": "YOUR_ADGROUP_ID",
30+
"campaignId": "YOUR_CAMPAIGN_ID",
31+
"themeType": "KEYWORDS_RELATED_TO_YOUR_BRAND",
32+
"bid": 0.75
33+
}
34+
# Add more theme objects as needed, up to 100
35+
]
36+
37+
# For a real scenario, you might read this from a file like in your Keywords example
38+
# file = open("create_themes.json")
39+
# data = file.read()
40+
# file.close()
41+
# result = Themes().create_themes(body=data)
42+
43+
result = Themes().create_themes(themes=themes_to_create)
44+
print(result)
45+
46+
### Example JSON (for request body)
47+
48+
.. code-block:: json
49+
50+
{
51+
"themes": [
52+
{
53+
"adGroupId": "string",
54+
"campaignId": "string",
55+
"themeType": "KEYWORDS_RELATED_TO_YOUR_BRAND|KEYWORDS_RELATED_TO_YOUR_LANDING_PAGES",
56+
"bid": 0.75
57+
}
58+
]
59+
}
60+
61+
62+
.. autofunction:: ad_api.api.sb.Themes.update_themes
63+
64+
### Example Python
65+
66+
.. code-block:: python
67+
68+
from ad_api.api.sb.themes import Themes
69+
import json
70+
71+
# Example data for themes to update
72+
themes_to_update = [
73+
{
74+
"themeId": "YOUR_THEME_ID",
75+
"adGroupId": "YOUR_ADGROUP_ID",
76+
"campaignId": "YOUR_CAMPAIGN_ID",
77+
"state": "paused", # or "enabled", "archived"
78+
"bid": 0.80 # Optional, if updating bid
79+
}
80+
# Add more theme objects as needed, up to 100
81+
]
82+
83+
# For a real scenario, you might read this from a file
84+
# file = open("update_themes.json")
85+
# data = file.read()
86+
# file.close()
87+
# result = Themes().update_themes(body=data)
88+
89+
result = Themes().update_themes(themes=themes_to_update)
90+
print(result)
91+
92+
### Example JSON (for request body)
93+
94+
.. code-block:: json
95+
96+
{
97+
"themes": [
98+
{
99+
"themeId": "string",
100+
"adGroupId": "string",
101+
"campaignId": "string",
102+
"state": "enabled|paused|archived",
103+
"bid": 0.80
104+
}
105+
]
106+
}

docs/sb_v3.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@
1919
sb/moderation
2020
sb/reports
2121
sb/snapshots
22+
sb/themes
2223

0 commit comments

Comments
 (0)