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
Copy file name to clipboardExpand all lines: docs/api/operations/goals.md
+16-1Lines changed: 16 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ The async version `AsyncGoalOperations` provides the same methods as above, but
26
26
show_inheritance_diagram: false
27
27
28
28
!!! info "Async Usage"
29
-
All methods have the same parameters and return types as their sync counterparts. Simply add `await` before each method call.
29
+
All methods have the same parameters and return types as their sync counterparts. Simply add `await` before each method call. The `create_many()` method has an additional `max_concurrent` parameter in the async version for controlling concurrency.
|`create()`| Create a new headline |`meeting_id` (int), `title` (str) |`owner_id` (int, defaults to current user), `notes` (str)|
110
+
|`update()`| Update a headline title |`headline_id` (int), `title` (str) | None|
111
+
|`details()`| Get detailed headline information |`headline_id`(int) | None |
112
+
|`list()`| Get headlines (defaults to current user) | None |`user_id` (int), `meeting_id` (int)|
113
+
|`delete()`| Delete a headline |`headline_id`(int) | None |
114
114
115
115
!!! note "Filtering"
116
116
Like todos, headlines can be filtered by either `user_id` or `meeting_id`, but not both.
117
117
118
+
!!! tip "Default Behavior"
119
+
When calling `list()` without parameters, it returns headlines for the current authenticated user. The `create()` method also defaults `owner_id` to the current user if not specified.
120
+
118
121
!!! note "Return Values"
119
122
The `update()` and `delete()` methods return `None` instead of boolean values.
|`update()`| Update an existing issue |`issue_id`, `title`, `notes`|`IssueDetails`|
119
120
|`complete()`| Mark an issue as solved |`issue_id`|`IssueDetails`|
120
121
@@ -170,4 +171,111 @@ The async version `AsyncIssueOperations` provides the same methods as above, but
170
171
```
171
172
172
173
!!! note "Update Requirements"
173
-
At least one of `title` or `notes` must be provided when calling `update()`. If neither is provided, a `ValueError` will be raised.
174
+
At least one of `title` or `notes` must be provided when calling `update()`. If neither is provided, a `ValueError` will be raised.
175
+
176
+
## Bulk Operations
177
+
178
+
### Creating Multiple Issues
179
+
180
+
=== "Sync"
181
+
182
+
```python
183
+
from bloomy import Client
184
+
185
+
with Client(api_key="your-api-key") as client:
186
+
# Create multiple issues at once
187
+
issues = [
188
+
{
189
+
"meeting_id": 123,
190
+
"title": "Server performance degradation",
191
+
"notes": "Response times increased by 50%"
192
+
},
193
+
{
194
+
"meeting_id": 123,
195
+
"title": "Database connection pool exhausted",
196
+
"user_id": 456,
197
+
"notes": "Max connections reached during peak hours"
198
+
},
199
+
{
200
+
"meeting_id": 789,
201
+
"title": "Authentication service timeout"
202
+
}
203
+
]
204
+
205
+
result = client.issue.create_many(issues)
206
+
207
+
# Check results
208
+
print(f"Successfully created {len(result.successful)} issues")
209
+
for issue in result.successful:
210
+
print(f"- Issue #{issue.id}: {issue.title}")
211
+
212
+
# Handle failures
213
+
if result.failed:
214
+
print(f"Failed to create {len(result.failed)} issues")
215
+
for error in result.failed:
216
+
print(f"- Index {error.index}: {error.error}")
217
+
print(f" Input: {error.input_data}")
218
+
```
219
+
220
+
=== "Async"
221
+
222
+
```python
223
+
import asyncio
224
+
from bloomy import AsyncClient
225
+
226
+
async def main():
227
+
async with AsyncClient(api_key="your-api-key") as client:
228
+
# Create multiple issues concurrently
229
+
issues = [
230
+
{
231
+
"meeting_id": 123,
232
+
"title": "Server performance degradation",
233
+
"notes": "Response times increased by 50%"
234
+
},
235
+
{
236
+
"meeting_id": 123,
237
+
"title": "Database connection pool exhausted",
238
+
"user_id": 456,
239
+
"notes": "Max connections reached during peak hours"
240
+
},
241
+
{
242
+
"meeting_id": 789,
243
+
"title": "Authentication service timeout"
244
+
}
245
+
]
246
+
247
+
# Control concurrency with max_concurrent parameter
248
+
result = await client.issue.create_many(issues, max_concurrent=5)
249
+
250
+
# Check results
251
+
print(f"Successfully created {len(result.successful)} issues")
252
+
for issue in result.successful:
253
+
print(f"- Issue #{issue.id}: {issue.title}")
254
+
255
+
# Handle failures
256
+
if result.failed:
257
+
print(f"Failed to create {len(result.failed)} issues")
258
+
for error in result.failed:
259
+
print(f"- Index {error.index}: {error.error}")
260
+
print(f" Input: {error.input_data}")
261
+
262
+
asyncio.run(main())
263
+
```
264
+
265
+
!!! info "Async Rate Limiting"
266
+
The async version of `create_many()` supports a `max_concurrent` parameter (default: 5) to control the maximum number of concurrent requests. This helps prevent rate limiting issues when creating large batches of issues.
267
+
268
+
```python
269
+
# Process more items concurrently for better performance
270
+
result = await client.issue.create_many(issues, max_concurrent=10)
271
+
272
+
# Process items more slowly to avoid rate limits
273
+
result = await client.issue.create_many(issues, max_concurrent=2)
274
+
```
275
+
276
+
!!! tip "Bulk Operation Best Practices"
277
+
- **Best-effort approach**: `create_many()` continues processing even if some issues fail to create
278
+
- **Check both lists**: Always inspect both `result.successful` and `result.failed` to handle partial failures
279
+
- **Required fields**: Each issue dict must include `meeting_id` and `title`
280
+
- **Optional fields**: `user_id` defaults to the authenticated user if not provided
281
+
- **Error handling**: Failed creations include the original input data and error message for debugging
0 commit comments