Skip to content

Commit

Permalink
docs: add bulk operations example to README
Browse files Browse the repository at this point in the history
  • Loading branch information
devin-ai-integration[bot] and rachael-t committed Feb 6, 2025
1 parent 4a217fb commit 37d72ad
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,31 @@ getUserChannelDataResponse, _ := client.Users.GetChannelData(ctx, &knock.GetUser
fmt.Printf("channel-data-found: %+v\n", getUserChannelDataResponse)
```
### Handling Bulk Operations
```go
// Get a bulk operation by ID
bulkOp, err := client.BulkOperations.Get(ctx, "bulk-op-id")
if err != nil {
// handle error
}

// Access error items safely using helper methods
for _, errorItem := range bulkOp.ErrorItems {
if msg := errorItem.GetMessage(); msg != "" {
fmt.Printf("Error message: %s\n", msg)
}
if code := errorItem.GetCode(); code != "" {
fmt.Printf("Error code: %s\n", code)
}

// Access any operation-specific fields
if data := errorItem.GetField("data"); data != nil {
fmt.Printf("Error data: %+v\n", data)
}
}
```
### Canceling workflows
```go
Expand Down

0 comments on commit 37d72ad

Please sign in to comment.