Skip to content

python: Add support for struct enums #1822

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 19, 2025
Merged

Conversation

svix-mman
Copy link
Contributor

@svix-mman svix-mman commented Mar 15, 2025

API to use struct enums

from svix.api import IngestSourceIn, CronConfig
# with fields
source_in = IngestSourceIn(
    name="name",
    type="cron",
    config=CronConfig(content_type="asd", payload="asd", schedule="asd"),
)
# without any fields
source_in = IngestSourceIn(name="name", type="generic-webhook", config={})

# read field
if isinstance(res.config, CronConfig):
    print(source_in.config.payload)

@svix-mman svix-mman requested a review from a team as a code owner March 15, 2025 23:51
@svix-mman svix-mman merged commit 4f8cb91 into main Mar 19, 2025
10 checks passed
@svix-mman svix-mman deleted the mendy/enable-python-codegen branch March 19, 2025 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants