vovk_hello_world v0.0.69 Checked with mypy Vovk.ts

A showcase app built with Next.js + Vovk.ts + Zod. For more details, visit https://vovk.dev/hello-world

License: MIT

# Install the package
pip install vovk_hello_world

UserRPC

UserRPC.update_user

Update user

Update user by ID

POST https://hello-world.vovk.dev/api/users/{id}

from vovk_hello_world import UserRPC

response = UserRPC.update_user(
    body={
        # -----
        # User data object
        # -----
        # User email
        "email": "john@example.com",
        # User profile object
        "profile": {
            # User full name
            "name": "John Doe",
            # User age
            "age": 25
        }
    },
    query={
        # -----
        # Query parameters
        # -----
        # Notification type
        "notify": "email"
    },
    params={
        # -----
        # Path parameters
        # -----
        # User ID
        "id": "123e4567-e89b-12d3-a456-426614174000"
    },
)

print(response)
{
    # -----
    # Response object
    # -----
    # Success status
    "success": true,
    # User ID
    "id": "00000000-0000-0000-0000-000000000000",
    # Notification type
    "notify": "email"
}

StreamRPC

StreamRPC.stream_tokens

Stream tokens

Stream tokens to the client

GET https://hello-world.vovk.dev/api/streams/tokens

from vovk_hello_world import StreamRPC

response = StreamRPC.stream_tokens()

for i, item in enumerate(response):
    print(f"iteration #{i}:\n {item}")
    # iteration #0:
    {
        # -----
        # Streamed token object
        # -----
        # Message from the token
        "message": "string"
    }

OpenApiRPC

OpenApiRPC.get_spec

OpenAPI spec

Get the OpenAPI spec for the “Hello World” app API

GET https://hello-world.vovk.dev/api/static/openapi.json

from vovk_hello_world import OpenApiRPC

response = OpenApiRPC.get_spec()