Skip to content

Commit c9689e4

Browse files
committed
Fix documentation to match SDK implementation
- Update usage guide examples to use correct method names and return types - Make MeetingInfo.title optional to handle None values from API - Remove conflicting README.md from docs directory - Ensure all examples use attribute access instead of dictionary access - Fix goal, todo, and scorecard operation examples
1 parent 06951a8 commit c9689e4

5 files changed

Lines changed: 40 additions & 81 deletions

File tree

docs/README.md

Lines changed: 0 additions & 40 deletions
This file was deleted.

docs/guide/authentication.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ from bloomy import Client, APIError
196196

197197
try:
198198
client = Client(api_key="invalid-key")
199-
client.user.me()
199+
client.user.details()
200200
except APIError as e:
201201
if e.status_code == 401:
202202
print("Authentication failed. Check your API key.")
@@ -245,8 +245,8 @@ client_account1 = Client(api_key="api-key-for-account-1")
245245
client_account2 = Client(api_key="api-key-for-account-2")
246246

247247
# Use different clients for different operations
248-
users_account1 = client_account1.user.list()
249-
users_account2 = client_account2.user.list()
248+
users_account1 = client_account1.user.all()
249+
users_account2 = client_account2.user.all()
250250
```
251251

252252
## Next Steps

docs/guide/errors.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ from bloomy import Client, BloomyError
2121

2222
try:
2323
client = Client(api_key="your-api-key")
24-
user = client.user.me()
24+
user = client.user.details()
2525
except BloomyError as e:
2626
print(f"Bloomy SDK error: {e}")
2727
```
@@ -35,7 +35,7 @@ from bloomy import Client, APIError
3535

3636
try:
3737
client = Client(api_key="invalid-key")
38-
user = client.user.me()
38+
user = client.user.details()
3939
except APIError as e:
4040
print(f"API error: {e.message}")
4141
print(f"Status code: {e.status_code}")
@@ -94,7 +94,7 @@ from bloomy import Client, APIError, ConfigurationError
9494

9595
try:
9696
client = Client()
97-
users = client.user.list()
97+
users = client.user.all()
9898
except ConfigurationError:
9999
print("Please configure your API key")
100100
except APIError as e:
@@ -151,7 +151,7 @@ def retry_with_backoff(func, max_retries=3, initial_delay=1):
151151

152152
# Usage
153153
client = Client(api_key="your-api-key")
154-
users = retry_with_backoff(lambda: client.user.list())
154+
users = retry_with_backoff(lambda: client.user.all())
155155
```
156156

157157
### Graceful Degradation
@@ -169,7 +169,7 @@ class BloomyService:
169169

170170
def get_current_user(self):
171171
try:
172-
self._cached_user = self.client.user.me()
172+
self._cached_user = self.client.user.details()
173173
return self._cached_user
174174
except APIError as e:
175175
logger.error(f"Failed to fetch user: {e}")
@@ -224,7 +224,7 @@ logger = logging.getLogger('bloomy_app')
224224
client = Client(api_key="your-api-key")
225225

226226
try:
227-
users = client.user.list()
227+
users = client.user.all()
228228
logger.info(f"Successfully fetched {len(users)} users")
229229
except APIError as e:
230230
logger.error(
@@ -258,7 +258,7 @@ def handle_api_errors(default=None):
258258

259259
# Usage
260260
with handle_api_errors(default=[]):
261-
users = client.user.list()
261+
users = client.user.all()
262262
```
263263

264264
## Best Practices
@@ -302,7 +302,7 @@ from bloomy import Client
302302

303303
try:
304304
client = Client(api_key="your-api-key")
305-
users = client.user.list()
305+
users = client.user.all()
306306
except httpx.TimeoutException:
307307
print("Request timed out. Please try again.")
308308
```

docs/guide/usage.md

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Many list operations return all results at once. For large datasets, consider fi
3333
```python
3434
# Get meetings for specific date range
3535
meetings = client.meeting.list()
36-
recent_meetings = [m for m in meetings if m['date'] >= '2024-01-01']
36+
recent_meetings = [m for m in meetings if m.id > 0] # Example filter
3737
```
3838

3939
### Filtering Results
@@ -43,11 +43,11 @@ Use Python's built-in filtering capabilities:
4343
```python
4444
# Get only incomplete todos
4545
todos = client.todo.list()
46-
open_todos = [t for t in todos if not t['complete']]
46+
open_todos = [t for t in todos if not t.complete]
4747

48-
# Get high-priority issues
48+
# Get issues for a meeting
4949
issues = client.issue.list(meeting_id=meeting_id)
50-
critical_issues = [i for i in issues if i['priority'] == 'high']
50+
# Note: Issues don't have a priority field in the API
5151
```
5252

5353
### Working with Dates
@@ -77,13 +77,11 @@ todo = client.todo.create(
7777
Process multiple items efficiently:
7878

7979
```python
80-
# Update multiple todos
80+
# Complete multiple todos
8181
todos_to_complete = client.todo.list()[:5]
8282
for todo in todos_to_complete:
83-
client.todo.update(
84-
todo_id=todo['id'],
85-
complete=True
86-
)
83+
if not todo.complete:
84+
client.todo.complete(todo.id)
8785
```
8886

8987
### Error Recovery
@@ -105,7 +103,7 @@ def retry_operation(func, max_retries=3, delay=1):
105103
raise
106104

107105
# Usage
108-
user = retry_operation(lambda: client.user.me())
106+
user = retry_operation(lambda: client.user.details())
109107
```
110108

111109
### Custom Headers
@@ -124,13 +122,13 @@ client = Client(api_key="your-api-key")
124122

125123
```python
126124
# Get current user
127-
me = client.user.me()
125+
me = client.user.details()
128126

129127
# Search for users
130128
users = client.user.search("John")
131129

132130
# Get user's direct reports
133-
reports = client.user.direct_reports(user_id=me['id'])
131+
reports = client.user.direct_reports(user_id=me.id)
134132
```
135133

136134
### Meetings
@@ -140,7 +138,7 @@ reports = client.user.direct_reports(user_id=me['id'])
140138
meetings = client.meeting.list()
141139

142140
# Get meeting details with participants
143-
meeting_id = meetings[0]['id']
141+
meeting_id = meetings[0].id
144142
details = client.meeting.details(meeting_id)
145143
attendees = client.meeting.attendees(meeting_id)
146144

@@ -152,34 +150,35 @@ issues = client.meeting.issues(meeting_id)
152150
### Goals (Rocks)
153151

154152
```python
155-
# Create a quarterly goal
153+
# Create a quarterly goal (requires meeting_id)
156154
goal = client.goal.create(
157155
title="Increase customer satisfaction to 95%",
158-
due_date="2024-12-31",
159-
status="on_track"
156+
meeting_id=meeting_id # Required parameter
160157
)
161158

162-
# Update progress
163-
client.goal.update(
164-
goal_id=goal['id'],
165-
status="complete",
166-
completion_percent=100
159+
# Update goal status
160+
updated = client.goal.update(
161+
goal_id=goal.id,
162+
status="complete" # Options: "on", "off", "at_risk", "complete"
167163
)
164+
print(f"Goal updated: {updated}") # Returns updated goal dict
168165
```
169166

170167
### Scorecard
171168

172169
```python
173-
# Get current week's scorecard
174-
scorecard = client.scorecard.week()
170+
# Get current week info
171+
current_week = client.scorecard.current_week()
172+
173+
# Get scorecard items
174+
scorecard_items = client.scorecard.list()
175175

176176
# Update a metric
177-
for metric in scorecard['metrics']:
178-
if metric['title'] == "Sales Calls":
179-
client.scorecard.update(
180-
score_id=metric['id'],
181-
value=45,
182-
met_goal=True
177+
for item in scorecard_items:
178+
if item.title == "Sales Calls":
179+
client.scorecard.score(
180+
measurable_id=item.measurable_id,
181+
score=45
183182
)
184183
```
185184

src/bloomy/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ class MeetingInfo(BloomyBaseModel):
334334
"""Model for meeting information."""
335335

336336
id: int
337-
title: str
337+
title: str | None = None
338338

339339

340340
class HeadlineInfo(BloomyBaseModel):

0 commit comments

Comments
 (0)