{"id":7850,"library":"vkbottle-types","title":"VKBottle Types","description":"vkbottle-types is a companion library to vkbottle, providing machine-generated type hints and Pydantic models for VK API methods and objects. It ensures robust type checking and auto-completion for developers working with the VK API. The current version is 5.199.99.20, with updates frequently released to reflect VK API changes.","status":"active","version":"5.199.99.20","language":"en","source_language":"en","source_url":"https://github.com/vkbottle/vkbottle-types","tags":["vk","api","types","pydantic","type-hinting","vkbottle"],"install":[{"cmd":"pip install vkbottle-types","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"note":"Commonly used Pydantic model for VK user profiles.","symbol":"UsersUser","correct":"from vkbottle_types.objects import UsersUser"},{"note":"Represents the raw message object from the VK API, frequently used in vkbottle message handlers.","symbol":"MessagesMessage","correct":"from vkbottle_types.objects import MessagesMessage"},{"note":"Provides type hints for VK API methods, useful for type-checking vkbottle's API object.","symbol":"APIMethods","correct":"from vkbottle_types.methods import APIMethods"},{"note":"The base Pydantic model from which all vkbottle-types objects inherit.","symbol":"BaseModel","correct":"from vkbottle_types.base_model import BaseModel"}],"quickstart":{"code":"import json\nfrom vkbottle_types.objects import UsersUser, MessagesMessage\n\n# Example 1: Instantiating a User type\nuser_data = {\n    \"id\": 12345,\n    \"first_name\": \"Alex\",\n    \"last_name\": \"Example\",\n    \"is_closed\": False,\n    \"can_access_closed\": True\n}\nuser: UsersUser = UsersUser(**user_data)\nprint(f\"User ID: {user.id}, Full Name: {user.first_name} {user.last_name}\")\nprint(f\"User JSON: {user.json(indent=2)}\")\n\n# Example 2: Demonstrating another type's structure\nmessage_payload_data = {\n    \"id\": 1,\n    \"peer_id\": 2000000001,\n    \"from_id\": 12345,\n    \"date\": 1678886400,\n    \"text\": \"Hello, vkbottle-types!\",\n    \"random_id\": 0,\n    \"attachments\": [],\n    \"fwd_messages\": [],\n    \"important\": False,\n    \"is_hidden\": False,\n    \"out\": 0,\n    \"conversation_message_id\": 1\n}\nmessage_payload: MessagesMessage = MessagesMessage(**message_payload_data)\nprint(f\"Message text: '{message_payload.text}' from user {message_payload.from_id}\")\n\n# These types are primarily used for type hinting and data validation\n# in vkbottle applications, not for direct API calls.","lang":"python","description":"This quickstart demonstrates how to instantiate and interact with Pydantic models provided by `vkbottle-types`. These models allow for strong type-hinting and validation of VK API objects, which are typically received or sent when using the `vkbottle` library."},"warnings":[{"fix":"Always update both `vkbottle` and `vkbottle-types` simultaneously using `pip install --upgrade vkbottle vkbottle-types`.","message":"vkbottle-types versions should always be kept compatible with your vkbottle library version. Mismatched versions can lead to `AttributeError`, `TypeError`, or `ImportError` due to schema changes or internal refactors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Monitor the vkbottle-types GitHub repository for updates following VK API announcements. If encountering `AttributeError` on a new field, it might indicate an unreleased change.","message":"As vkbottle-types directly mirrors the VK API schema, rapid changes in the VK API might lead to temporary inconsistencies. The library's types may not exactly match the latest API responses until an update is released.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Refer to the VK API documentation for the exact structure of complex objects or use vkbottle's parsing mechanisms when available.","message":"Instantiating some nested or polymorphic types directly from raw data can be challenging. Ensure your data structure precisely matches the expected Pydantic schema for complex objects to avoid `TypeError` or validation errors.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Update `vkbottle-types` to the latest version (`pip install --upgrade vkbottle-types`) or verify the field name against official VK API documentation.","cause":"The VK API has introduced a new field that is not yet reflected in your installed `vkbottle-types` version, or the field name was misspelled.","error":"AttributeError: 'MessagesMessage' object has no attribute 'some_new_field'"},{"fix":"Review the `vkbottle-types` model definition (e.g., in its source code) or VK API documentation for the correct and current field names. Remove or rename the problematic argument.","cause":"The VK API schema (and thus `vkbottle-types`) has removed or renamed a field that you are attempting to provide during model instantiation.","error":"TypeError: __init__() got an unexpected keyword argument 'old_field_name'"},{"fix":"Consult the `vkbottle-types` documentation or explore the `vkbottle_types` package content (e.g., using an IDE's autocomplete or `dir()`) to find the correct import path and symbol name.","cause":"The specified type name is incorrect, misspelled, or the type has been moved/renamed in a newer version of `vkbottle-types`.","error":"ImportError: cannot import name 'SomeType' from 'vkbottle_types.objects'"}]}