mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2026-04-21 00:59:50 -05:00
4a50e454a6
* feat: client example * fix: batch i * fix: batch ii * fix: batch iii * fix: batch iv
31 lines
691 B
Python
31 lines
691 B
Python
from hatchet_sdk import Hatchet, PushEventOptions
|
|
from hatchet_sdk.clients.events import BulkPushEventWithMetadata
|
|
|
|
hatchet = Hatchet()
|
|
|
|
# > Event trigger
|
|
hatchet.event.push("user:create", {"should_skip": False})
|
|
# !!
|
|
|
|
# > Event trigger with metadata
|
|
hatchet.event.push(
|
|
"user:create",
|
|
{"userId": "1234", "should_skip": False},
|
|
options=PushEventOptions(
|
|
additional_metadata={"source": "api"} # Arbitrary key-value pair
|
|
),
|
|
)
|
|
# !!
|
|
|
|
# > Bulk event push
|
|
hatchet.event.bulk_push(
|
|
events=[
|
|
BulkPushEventWithMetadata(
|
|
key="user:create",
|
|
payload={"userId": str(i), "should_skip": False},
|
|
)
|
|
for i in range(10)
|
|
]
|
|
)
|
|
# !!
|