vrchatapi-async 1.20.8.dev1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vrchatapi/__init__.py +742 -0
- vrchatapi/api/__init__.py +23 -0
- vrchatapi/api/authentication_api.py +6253 -0
- vrchatapi/api/avatars_api.py +4234 -0
- vrchatapi/api/calendar_api.py +4090 -0
- vrchatapi/api/economy_api.py +11547 -0
- vrchatapi/api/favorites_api.py +2368 -0
- vrchatapi/api/files_api.py +6109 -0
- vrchatapi/api/friends_api.py +1708 -0
- vrchatapi/api/groups_api.py +15085 -0
- vrchatapi/api/instances_api.py +1754 -0
- vrchatapi/api/inventory_api.py +4333 -0
- vrchatapi/api/invite_api.py +3337 -0
- vrchatapi/api/jams_api.py +1446 -0
- vrchatapi/api/miscellaneous_api.py +2384 -0
- vrchatapi/api/notifications_api.py +3624 -0
- vrchatapi/api/playermoderation_api.py +1127 -0
- vrchatapi/api/prints_api.py +1478 -0
- vrchatapi/api/props_api.py +2269 -0
- vrchatapi/api/users_api.py +7894 -0
- vrchatapi/api/worlds_api.py +6153 -0
- vrchatapi/api_client.py +865 -0
- vrchatapi/api_response.py +21 -0
- vrchatapi/configuration.py +686 -0
- vrchatapi/exceptions.py +218 -0
- vrchatapi/models/__init__.py +345 -0
- vrchatapi/models/account_deletion_log.py +253 -0
- vrchatapi/models/add_favorite_request.py +246 -0
- vrchatapi/models/add_group_gallery_image_request.py +234 -0
- vrchatapi/models/admin_asset_bundle.py +337 -0
- vrchatapi/models/admin_unity_package.py +261 -0
- vrchatapi/models/age_verification_status.py +38 -0
- vrchatapi/models/agreement.py +280 -0
- vrchatapi/models/agreement_code.py +36 -0
- vrchatapi/models/agreement_request.py +256 -0
- vrchatapi/models/agreement_status.py +261 -0
- vrchatapi/models/api_config.py +1299 -0
- vrchatapi/models/api_config_access_logs_urls.py +258 -0
- vrchatapi/models/api_config_announcement.py +217 -0
- vrchatapi/models/api_config_audio_config.py +311 -0
- vrchatapi/models/api_config_avatar_perf_limiter.py +293 -0
- vrchatapi/models/api_config_constants.py +262 -0
- vrchatapi/models/api_config_constants_groups.py +306 -0
- vrchatapi/models/api_config_constants_instance.py +238 -0
- vrchatapi/models/api_config_constants_instancepopulationbrackets.py +262 -0
- vrchatapi/models/api_config_constants_instancepopulationbracketscrowded.py +216 -0
- vrchatapi/models/api_config_constants_instancepopulationbracketsfew.py +216 -0
- vrchatapi/models/api_config_constants_instancepopulationbracketsmany.py +216 -0
- vrchatapi/models/api_config_constants_language.py +234 -0
- vrchatapi/models/api_config_download_url_list.py +258 -0
- vrchatapi/models/api_config_events.py +314 -0
- vrchatapi/models/api_config_ios_version.py +216 -0
- vrchatapi/models/api_config_min_supported_client_build_number.py +348 -0
- vrchatapi/models/api_config_offline_analysis.py +216 -0
- vrchatapi/models/api_health.py +248 -0
- vrchatapi/models/avatar.py +463 -0
- vrchatapi/models/avatar_moderation.py +249 -0
- vrchatapi/models/avatar_moderation_created.py +248 -0
- vrchatapi/models/avatar_moderation_type.py +36 -0
- vrchatapi/models/avatar_performance.py +265 -0
- vrchatapi/models/avatar_published_listings_inner.py +271 -0
- vrchatapi/models/avatar_style.py +239 -0
- vrchatapi/models/avatar_styles.py +231 -0
- vrchatapi/models/avatar_unity_package_url_object.py +234 -0
- vrchatapi/models/badge.py +308 -0
- vrchatapi/models/balance.py +247 -0
- vrchatapi/models/ban_group_member_request.py +234 -0
- vrchatapi/models/boop_request.py +250 -0
- vrchatapi/models/calendar_day_of_week.py +42 -0
- vrchatapi/models/calendar_event.py +475 -0
- vrchatapi/models/calendar_event_access.py +37 -0
- vrchatapi/models/calendar_event_category.py +48 -0
- vrchatapi/models/calendar_event_discovery.py +247 -0
- vrchatapi/models/calendar_event_discovery_inclusion.py +38 -0
- vrchatapi/models/calendar_event_discovery_scope.py +38 -0
- vrchatapi/models/calendar_event_frequency.py +39 -0
- vrchatapi/models/calendar_event_occurrence_kind.py +38 -0
- vrchatapi/models/calendar_event_platform.py +38 -0
- vrchatapi/models/calendar_event_recurrence.py +261 -0
- vrchatapi/models/calendar_event_recurrence_end.py +246 -0
- vrchatapi/models/calendar_event_recurrence_end_type.py +37 -0
- vrchatapi/models/calendar_event_user_interest.py +251 -0
- vrchatapi/models/change_user_tags_request.py +212 -0
- vrchatapi/models/change_world_tags_request.py +212 -0
- vrchatapi/models/content_filter.py +40 -0
- vrchatapi/models/create_avatar_moderation_request.py +243 -0
- vrchatapi/models/create_avatar_request.py +324 -0
- vrchatapi/models/create_calendar_event_request.py +385 -0
- vrchatapi/models/create_file_request.py +251 -0
- vrchatapi/models/create_file_version_request.py +259 -0
- vrchatapi/models/create_group_announcement_request.py +253 -0
- vrchatapi/models/create_group_gallery_request.py +297 -0
- vrchatapi/models/create_group_invite_request.py +242 -0
- vrchatapi/models/create_group_post_request.py +267 -0
- vrchatapi/models/create_group_request.py +295 -0
- vrchatapi/models/create_group_role_request.py +255 -0
- vrchatapi/models/create_instance_request.py +384 -0
- vrchatapi/models/create_jam_submission_request.py +239 -0
- vrchatapi/models/create_listing_request.py +285 -0
- vrchatapi/models/create_product_request.py +270 -0
- vrchatapi/models/create_prop_request.py +308 -0
- vrchatapi/models/create_world_request.py +322 -0
- vrchatapi/models/current_user.py +909 -0
- vrchatapi/models/current_user_platform_history_inner.py +245 -0
- vrchatapi/models/current_user_presence.py +379 -0
- vrchatapi/models/decline_group_invite_request.py +211 -0
- vrchatapi/models/developer_type.py +39 -0
- vrchatapi/models/disable2_fa_result.py +211 -0
- vrchatapi/models/discord_details.py +216 -0
- vrchatapi/models/dynamic_content_row.py +276 -0
- vrchatapi/models/earnings_metrics.py +248 -0
- vrchatapi/models/earnings_metrics_totals.py +267 -0
- vrchatapi/models/economy_account.py +360 -0
- vrchatapi/models/economy_balances.py +221 -0
- vrchatapi/models/economy_payout.py +385 -0
- vrchatapi/models/economy_payout_eligibility.py +263 -0
- vrchatapi/models/economy_payout_list.py +219 -0
- vrchatapi/models/economy_payout_status.py +295 -0
- vrchatapi/models/equip_inventory_item_request.py +235 -0
- vrchatapi/models/error.py +215 -0
- vrchatapi/models/favorite.py +251 -0
- vrchatapi/models/favorite_group.py +278 -0
- vrchatapi/models/favorite_group_limits.py +249 -0
- vrchatapi/models/favorite_group_visibility.py +38 -0
- vrchatapi/models/favorite_limits.py +265 -0
- vrchatapi/models/favorite_type.py +39 -0
- vrchatapi/models/favorited_world.py +441 -0
- vrchatapi/models/feedback.py +331 -0
- vrchatapi/models/file.py +325 -0
- vrchatapi/models/file_analysis.py +281 -0
- vrchatapi/models/file_analysis_avatar_stats.py +575 -0
- vrchatapi/models/file_data.py +279 -0
- vrchatapi/models/file_status.py +39 -0
- vrchatapi/models/file_upload_url.py +212 -0
- vrchatapi/models/file_version.py +254 -0
- vrchatapi/models/file_version_upload_status.py +269 -0
- vrchatapi/models/finish_file_data_upload_request.py +248 -0
- vrchatapi/models/follow_calendar_event_request.py +234 -0
- vrchatapi/models/friend_status.py +250 -0
- vrchatapi/models/get_group_posts200_response.py +219 -0
- vrchatapi/models/get_user_group_instances200_response.py +248 -0
- vrchatapi/models/group.py +514 -0
- vrchatapi/models/group_access_type.py +38 -0
- vrchatapi/models/group_announcement.py +315 -0
- vrchatapi/models/group_audit_log_entry.py +287 -0
- vrchatapi/models/group_gallery.py +319 -0
- vrchatapi/models/group_gallery_file_order.py +211 -0
- vrchatapi/models/group_gallery_file_order_request.py +239 -0
- vrchatapi/models/group_gallery_image.py +301 -0
- vrchatapi/models/group_instance.py +257 -0
- vrchatapi/models/group_join_request_action.py +37 -0
- vrchatapi/models/group_join_state.py +39 -0
- vrchatapi/models/group_member.py +415 -0
- vrchatapi/models/group_member_limited_user.py +290 -0
- vrchatapi/models/group_member_status.py +41 -0
- vrchatapi/models/group_my_member.py +399 -0
- vrchatapi/models/group_permission.py +260 -0
- vrchatapi/models/group_permissions.py +63 -0
- vrchatapi/models/group_post.py +317 -0
- vrchatapi/models/group_post_visibility.py +37 -0
- vrchatapi/models/group_privacy.py +37 -0
- vrchatapi/models/group_role.py +309 -0
- vrchatapi/models/group_role_template.py +39 -0
- vrchatapi/models/group_role_template_values.py +254 -0
- vrchatapi/models/group_role_template_values_roles.py +253 -0
- vrchatapi/models/group_search_sort.py +37 -0
- vrchatapi/models/group_transferable.py +215 -0
- vrchatapi/models/group_transferable_requirements.py +266 -0
- vrchatapi/models/group_user_visibility.py +38 -0
- vrchatapi/models/image_animation_style.py +62 -0
- vrchatapi/models/image_loop_style.py +37 -0
- vrchatapi/models/image_mask.py +41 -0
- vrchatapi/models/image_purpose.py +46 -0
- vrchatapi/models/info_push.py +306 -0
- vrchatapi/models/info_push_data.py +288 -0
- vrchatapi/models/info_push_data_article.py +215 -0
- vrchatapi/models/info_push_data_article_content.py +251 -0
- vrchatapi/models/info_push_data_clickable.py +224 -0
- vrchatapi/models/instance.py +597 -0
- vrchatapi/models/instance_content_settings.py +236 -0
- vrchatapi/models/instance_platforms.py +222 -0
- vrchatapi/models/instance_region.py +40 -0
- vrchatapi/models/instance_short_name_response.py +248 -0
- vrchatapi/models/instance_type.py +40 -0
- vrchatapi/models/inventory.py +247 -0
- vrchatapi/models/inventory_consumption_results.py +255 -0
- vrchatapi/models/inventory_default_attributes_value.py +243 -0
- vrchatapi/models/inventory_default_attributes_value_validator.py +211 -0
- vrchatapi/models/inventory_drop.py +331 -0
- vrchatapi/models/inventory_equip_slot.py +39 -0
- vrchatapi/models/inventory_flag.py +43 -0
- vrchatapi/models/inventory_item.py +420 -0
- vrchatapi/models/inventory_item_type.py +42 -0
- vrchatapi/models/inventory_metadata.py +287 -0
- vrchatapi/models/inventory_notification_details.py +244 -0
- vrchatapi/models/inventory_spawn.py +216 -0
- vrchatapi/models/inventory_template.py +351 -0
- vrchatapi/models/inventory_user_attributes.py +250 -0
- vrchatapi/models/invite_message.py +276 -0
- vrchatapi/models/invite_message_type.py +39 -0
- vrchatapi/models/invite_request.py +243 -0
- vrchatapi/models/invite_response.py +235 -0
- vrchatapi/models/jam.py +302 -0
- vrchatapi/models/jam_state_change_dates.py +276 -0
- vrchatapi/models/jam_submission.py +275 -0
- vrchatapi/models/join_group_request.py +234 -0
- vrchatapi/models/license.py +261 -0
- vrchatapi/models/license_action.py +37 -0
- vrchatapi/models/license_group.py +235 -0
- vrchatapi/models/license_type.py +39 -0
- vrchatapi/models/limited_group.py +377 -0
- vrchatapi/models/limited_unity_package.py +251 -0
- vrchatapi/models/limited_user_friend.py +399 -0
- vrchatapi/models/limited_user_groups.py +386 -0
- vrchatapi/models/limited_user_instance.py +430 -0
- vrchatapi/models/limited_user_search.py +395 -0
- vrchatapi/models/limited_world.py +410 -0
- vrchatapi/models/mime_type.py +50 -0
- vrchatapi/models/model_print.py +299 -0
- vrchatapi/models/moderate_user_request.py +217 -0
- vrchatapi/models/moderation_report.py +296 -0
- vrchatapi/models/mutual_friend.py +302 -0
- vrchatapi/models/mutuals.py +217 -0
- vrchatapi/models/notification.py +283 -0
- vrchatapi/models/notification_detail_invite.py +250 -0
- vrchatapi/models/notification_detail_invite_response.py +242 -0
- vrchatapi/models/notification_detail_request_invite.py +239 -0
- vrchatapi/models/notification_detail_request_invite_response.py +242 -0
- vrchatapi/models/notification_detail_vote_to_kick.py +242 -0
- vrchatapi/models/notification_type.py +43 -0
- vrchatapi/models/notification_v2.py +466 -0
- vrchatapi/models/notification_v2_details_boop.py +255 -0
- vrchatapi/models/notification_v2_response.py +259 -0
- vrchatapi/models/notification_v2_type.py +58 -0
- vrchatapi/models/ok_status.py +211 -0
- vrchatapi/models/ok_status2.py +234 -0
- vrchatapi/models/order_option.py +37 -0
- vrchatapi/models/order_option_short.py +37 -0
- vrchatapi/models/paginated_calendar_event_list.py +255 -0
- vrchatapi/models/paginated_group_audit_log_entry_list.py +255 -0
- vrchatapi/models/paginated_moderation_report_list.py +255 -0
- vrchatapi/models/past_display_name.py +241 -0
- vrchatapi/models/pending2_fa_result.py +239 -0
- vrchatapi/models/performance_limiter_info.py +234 -0
- vrchatapi/models/performance_ratings.py +41 -0
- vrchatapi/models/permission.py +280 -0
- vrchatapi/models/permission_data.py +258 -0
- vrchatapi/models/platform_build_info.py +242 -0
- vrchatapi/models/player_moderation.py +276 -0
- vrchatapi/models/player_moderation_type.py +44 -0
- vrchatapi/models/print_files.py +239 -0
- vrchatapi/models/private_profile.py +267 -0
- vrchatapi/models/private_profile_activity.py +292 -0
- vrchatapi/models/product.py +389 -0
- vrchatapi/models/product_listing.py +538 -0
- vrchatapi/models/product_listing_type.py +39 -0
- vrchatapi/models/product_listing_variant.py +272 -0
- vrchatapi/models/product_purchase.py +571 -0
- vrchatapi/models/product_purchase_history.py +256 -0
- vrchatapi/models/product_purchase_location_type.py +46 -0
- vrchatapi/models/product_purchase_product.py +269 -0
- vrchatapi/models/product_purchase_purchase_context.py +250 -0
- vrchatapi/models/product_purchase_record.py +312 -0
- vrchatapi/models/product_type.py +39 -0
- vrchatapi/models/profile_represented_group.py +262 -0
- vrchatapi/models/prop.py +358 -0
- vrchatapi/models/prop_publish_status.py +234 -0
- vrchatapi/models/prop_unity_package.py +269 -0
- vrchatapi/models/public_profile.py +398 -0
- vrchatapi/models/purchase_context_data.py +251 -0
- vrchatapi/models/purchase_product_listing_request.py +281 -0
- vrchatapi/models/region.py +42 -0
- vrchatapi/models/register_user_account_request.py +278 -0
- vrchatapi/models/release_status.py +39 -0
- vrchatapi/models/report_category.py +226 -0
- vrchatapi/models/report_reason.py +216 -0
- vrchatapi/models/represented_group.py +348 -0
- vrchatapi/models/request_invite_request.py +235 -0
- vrchatapi/models/respond_group_join_request.py +217 -0
- vrchatapi/models/respond_notification_v2_request.py +242 -0
- vrchatapi/models/response.py +217 -0
- vrchatapi/models/reward_badge.py +308 -0
- vrchatapi/models/reward_redemption.py +220 -0
- vrchatapi/models/reward_redemption_data.py +224 -0
- vrchatapi/models/reward_redemption_request.py +211 -0
- vrchatapi/models/reward_redemption_result.py +250 -0
- vrchatapi/models/search_group_members200_response.py +224 -0
- vrchatapi/models/seller_eligibility.py +211 -0
- vrchatapi/models/sent_notification.py +278 -0
- vrchatapi/models/service_queue_stats.py +234 -0
- vrchatapi/models/service_status.py +281 -0
- vrchatapi/models/share_inventory_item_direct_request.py +239 -0
- vrchatapi/models/sort_option.py +53 -0
- vrchatapi/models/sort_option_product_purchase.py +36 -0
- vrchatapi/models/store.py +372 -0
- vrchatapi/models/store_context.py +249 -0
- vrchatapi/models/store_shelf.py +304 -0
- vrchatapi/models/store_type.py +38 -0
- vrchatapi/models/store_view.py +40 -0
- vrchatapi/models/submit_moderation_report_request.py +263 -0
- vrchatapi/models/submit_moderation_report_request_details.py +283 -0
- vrchatapi/models/subscription.py +301 -0
- vrchatapi/models/subscription_period.py +40 -0
- vrchatapi/models/success.py +215 -0
- vrchatapi/models/success_flag.py +211 -0
- vrchatapi/models/tilia_kyc.py +246 -0
- vrchatapi/models/tilia_status.py +259 -0
- vrchatapi/models/tilia_tos.py +211 -0
- vrchatapi/models/token_bundle.py +286 -0
- vrchatapi/models/transaction.py +322 -0
- vrchatapi/models/transaction_agreement.py +353 -0
- vrchatapi/models/transaction_status.py +39 -0
- vrchatapi/models/transaction_steam_info.py +271 -0
- vrchatapi/models/transaction_steam_wallet_info.py +227 -0
- vrchatapi/models/transfer_group_request.py +234 -0
- vrchatapi/models/tutorial_status.py +255 -0
- vrchatapi/models/two_factor_auth_code.py +211 -0
- vrchatapi/models/two_factor_email_code.py +211 -0
- vrchatapi/models/two_factor_recovery_codes.py +247 -0
- vrchatapi/models/two_factor_recovery_codes_otp_inner.py +216 -0
- vrchatapi/models/unity_package.py +360 -0
- vrchatapi/models/update_asset_review_notes_request.py +234 -0
- vrchatapi/models/update_avatar_request.py +293 -0
- vrchatapi/models/update_calendar_event_request.py +365 -0
- vrchatapi/models/update_favorite_group_request.py +246 -0
- vrchatapi/models/update_group_gallery_request.py +297 -0
- vrchatapi/models/update_group_member_request.py +256 -0
- vrchatapi/models/update_group_representation_request.py +234 -0
- vrchatapi/models/update_group_request.py +300 -0
- vrchatapi/models/update_group_role_request.py +255 -0
- vrchatapi/models/update_inventory_item_request.py +254 -0
- vrchatapi/models/update_invite_message_request.py +211 -0
- vrchatapi/models/update_listing_request.py +211 -0
- vrchatapi/models/update_product_request.py +261 -0
- vrchatapi/models/update_prop_request.py +303 -0
- vrchatapi/models/update_tilia_tos_request.py +211 -0
- vrchatapi/models/update_user_badge_request.py +216 -0
- vrchatapi/models/update_user_note_request.py +239 -0
- vrchatapi/models/update_user_request.py +358 -0
- vrchatapi/models/update_world_request.py +317 -0
- vrchatapi/models/user.py +549 -0
- vrchatapi/models/user_credits_eligible.py +216 -0
- vrchatapi/models/user_exists.py +242 -0
- vrchatapi/models/user_note.py +273 -0
- vrchatapi/models/user_note_target_user.py +277 -0
- vrchatapi/models/user_state.py +38 -0
- vrchatapi/models/user_status.py +40 -0
- vrchatapi/models/user_subscription.py +330 -0
- vrchatapi/models/user_subscription_eligible.py +274 -0
- vrchatapi/models/verify2_fa_email_code_result.py +211 -0
- vrchatapi/models/verify2_fa_result.py +216 -0
- vrchatapi/models/verify_auth_token_result.py +217 -0
- vrchatapi/models/world.py +459 -0
- vrchatapi/models/world_metadata.py +216 -0
- vrchatapi/models/world_publish_status.py +234 -0
- vrchatapi/py.typed +0 -0
- vrchatapi/rest.py +303 -0
- vrchatapi_async-1.20.8.dev1.dist-info/METADATA +137 -0
- vrchatapi_async-1.20.8.dev1.dist-info/RECORD +362 -0
- vrchatapi_async-1.20.8.dev1.dist-info/WHEEL +5 -0
- vrchatapi_async-1.20.8.dev1.dist-info/licenses/LICENSE +21 -0
- vrchatapi_async-1.20.8.dev1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
VRChat API Documentation
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
The version of the OpenAPI document: 1.20.8
|
|
8
|
+
Contact: vrchatapi.lpv0t@aries.fyi
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from collections.abc import Mapping as _Mapping
|
|
21
|
+
from pydantic import AliasChoices, BaseModel, ConfigDict, Field, StrictBool
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, cast as _cast
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
from pydantic_core import to_jsonable_python
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
_OPENAPI_GENERATOR_TO_DICT = "_openapi_generator_to_dict"
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _get_openapi_to_dict(value: Any) -> Any:
|
|
32
|
+
# Reciprocal function references preserve inherited generated methods
|
|
33
|
+
# without reserving model member names. Checking both directions also
|
|
34
|
+
# rejects overrides whose decorators copy function attributes.
|
|
35
|
+
to_dict = getattr(value, "to_dict", None)
|
|
36
|
+
type_to_dict = getattr(type(value), "to_dict", None)
|
|
37
|
+
if (
|
|
38
|
+
not callable(to_dict)
|
|
39
|
+
or getattr(to_dict, "__func__", None) is not type_to_dict
|
|
40
|
+
):
|
|
41
|
+
return None
|
|
42
|
+
|
|
43
|
+
openapi_to_dict = getattr(
|
|
44
|
+
type_to_dict, _OPENAPI_GENERATOR_TO_DICT, None
|
|
45
|
+
)
|
|
46
|
+
if (
|
|
47
|
+
not callable(openapi_to_dict)
|
|
48
|
+
or getattr(
|
|
49
|
+
openapi_to_dict,
|
|
50
|
+
_OPENAPI_GENERATOR_TO_DICT,
|
|
51
|
+
None,
|
|
52
|
+
) is not type_to_dict
|
|
53
|
+
):
|
|
54
|
+
return None
|
|
55
|
+
return openapi_to_dict
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def _to_legacy_item(value: Any, serialize: bool) -> Any:
|
|
59
|
+
to_dict = getattr(value, "to_dict", None)
|
|
60
|
+
if _get_openapi_to_dict(value) is not None and callable(to_dict):
|
|
61
|
+
return to_dict(serialize=serialize)
|
|
62
|
+
if callable(to_dict):
|
|
63
|
+
return to_dict()
|
|
64
|
+
return value
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def _to_legacy_value(value: Any, serialize: bool) -> Any:
|
|
68
|
+
# python-legacy converted only immediate list elements or dictionary values:
|
|
69
|
+
# https://github.com/OpenAPITools/openapi-generator/blob/c84b949df1a9ec04ba75989cb49b45c940c2f694/modules/openapi-generator/src/main/resources/python-legacy/model.mustache#L203-L231
|
|
70
|
+
if isinstance(value, list):
|
|
71
|
+
return [_to_legacy_item(item, serialize) for item in value]
|
|
72
|
+
if isinstance(value, dict):
|
|
73
|
+
return {
|
|
74
|
+
key: _to_legacy_item(item, serialize)
|
|
75
|
+
for key, item in value.items()
|
|
76
|
+
}
|
|
77
|
+
return _to_legacy_item(value, serialize)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def _to_openapi_value(value: Any) -> Any:
|
|
81
|
+
if isinstance(value, list):
|
|
82
|
+
return [_to_openapi_value(item) for item in value]
|
|
83
|
+
if isinstance(value, dict):
|
|
84
|
+
return {key: _to_openapi_value(item) for key, item in value.items()}
|
|
85
|
+
|
|
86
|
+
to_openapi_dict = _get_openapi_to_dict(value)
|
|
87
|
+
if to_openapi_dict is not None:
|
|
88
|
+
return to_openapi_dict(value)
|
|
89
|
+
|
|
90
|
+
to_dict = getattr(value, "to_dict", None)
|
|
91
|
+
if callable(to_dict):
|
|
92
|
+
return to_dict()
|
|
93
|
+
return value
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
class WorldPublishStatus(BaseModel):
|
|
97
|
+
"""
|
|
98
|
+
WorldPublishStatus
|
|
99
|
+
|
|
100
|
+
Attributes:
|
|
101
|
+
openapi_types (dict): The key is attribute name
|
|
102
|
+
and the value is attribute type.
|
|
103
|
+
attribute_map (dict): The key is attribute name
|
|
104
|
+
and the value is json key in definition.
|
|
105
|
+
""" # noqa: E501
|
|
106
|
+
can_publish: Optional[StrictBool] = Field(default=None, validation_alias=AliasChoices("canPublish", "can_publish"), serialization_alias="canPublish")
|
|
107
|
+
openapi_types: ClassVar[Dict[str, str]] = {
|
|
108
|
+
"can_publish": "bool"
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
attribute_map: ClassVar[Dict[str, str]] = {
|
|
112
|
+
"can_publish": "canPublish"
|
|
113
|
+
}
|
|
114
|
+
__properties: ClassVar[List[str]] = ["canPublish"]
|
|
115
|
+
|
|
116
|
+
@classmethod
|
|
117
|
+
def __preprocess_input_names(
|
|
118
|
+
cls,
|
|
119
|
+
obj: Any,
|
|
120
|
+
remove_hidden_storage_names: bool = True,
|
|
121
|
+
) -> Any:
|
|
122
|
+
if not isinstance(obj, _Mapping):
|
|
123
|
+
return obj
|
|
124
|
+
obj = dict(obj)
|
|
125
|
+
if "canPublish" not in obj and "can_publish" in obj:
|
|
126
|
+
obj["canPublish"] = obj["can_publish"]
|
|
127
|
+
obj.pop("can_publish", None)
|
|
128
|
+
return obj
|
|
129
|
+
|
|
130
|
+
model_config = ConfigDict(
|
|
131
|
+
validate_by_name=True,
|
|
132
|
+
validate_by_alias=True,
|
|
133
|
+
validate_assignment=True,
|
|
134
|
+
extra="forbid",
|
|
135
|
+
protected_namespaces=(),
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def to_str(self) -> str:
|
|
140
|
+
"""Returns the string representation of the model"""
|
|
141
|
+
return pprint.pformat(self.to_dict())
|
|
142
|
+
|
|
143
|
+
def __repr__(self) -> str:
|
|
144
|
+
"""For print and pprint"""
|
|
145
|
+
return self.to_str()
|
|
146
|
+
|
|
147
|
+
def __eq__(self, other: object) -> bool:
|
|
148
|
+
"""Returns true if both objects are equal"""
|
|
149
|
+
if not isinstance(other, WorldPublishStatus):
|
|
150
|
+
return False
|
|
151
|
+
|
|
152
|
+
return self.to_dict() == other.to_dict()
|
|
153
|
+
|
|
154
|
+
def __ne__(self, other: object) -> bool:
|
|
155
|
+
"""Returns true if both objects are not equal"""
|
|
156
|
+
if not isinstance(other, WorldPublishStatus):
|
|
157
|
+
return True
|
|
158
|
+
|
|
159
|
+
return not (self == other)
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
def to_json(self) -> str:
|
|
163
|
+
"""Returns the JSON representation of the model using alias"""
|
|
164
|
+
to_openapi_dict = _get_openapi_to_dict(self)
|
|
165
|
+
if to_openapi_dict is not None:
|
|
166
|
+
return json.dumps(to_jsonable_python(to_openapi_dict(self)))
|
|
167
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
168
|
+
|
|
169
|
+
@classmethod
|
|
170
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
171
|
+
"""Create an instance of WorldPublishStatus from a JSON string"""
|
|
172
|
+
return cls.from_dict(json.loads(json_str))
|
|
173
|
+
|
|
174
|
+
def to_dict(self, serialize: bool = False) -> Dict[str, Any]:
|
|
175
|
+
"""Return all declared model fields using public or wire names."""
|
|
176
|
+
return {
|
|
177
|
+
("canPublish" if serialize else "can_publish"): _to_legacy_value(getattr(self, "can_publish", None), serialize),
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
def __openapi_generator_modern_projection(self) -> Dict[str, Any]:
|
|
181
|
+
"""Return the dictionary representation of the model using alias.
|
|
182
|
+
|
|
183
|
+
This has the following differences from calling pydantic's
|
|
184
|
+
`self.model_dump(by_alias=True)`:
|
|
185
|
+
|
|
186
|
+
* `None` is only added to the output dict for nullable fields that
|
|
187
|
+
were set at model initialization. Other fields with value `None`
|
|
188
|
+
are ignored.
|
|
189
|
+
"""
|
|
190
|
+
excluded_fields: Set[str] = set([
|
|
191
|
+
])
|
|
192
|
+
|
|
193
|
+
_dict = self.model_dump(
|
|
194
|
+
by_alias=True,
|
|
195
|
+
exclude=excluded_fields,
|
|
196
|
+
exclude_none=True,
|
|
197
|
+
)
|
|
198
|
+
return _dict
|
|
199
|
+
|
|
200
|
+
setattr(
|
|
201
|
+
to_dict,
|
|
202
|
+
_OPENAPI_GENERATOR_TO_DICT,
|
|
203
|
+
__openapi_generator_modern_projection,
|
|
204
|
+
)
|
|
205
|
+
setattr(
|
|
206
|
+
__openapi_generator_modern_projection,
|
|
207
|
+
_OPENAPI_GENERATOR_TO_DICT,
|
|
208
|
+
to_dict,
|
|
209
|
+
)
|
|
210
|
+
del __openapi_generator_modern_projection
|
|
211
|
+
|
|
212
|
+
@classmethod
|
|
213
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
214
|
+
"""Create an instance of WorldPublishStatus from a dict"""
|
|
215
|
+
if obj is None:
|
|
216
|
+
return None
|
|
217
|
+
|
|
218
|
+
if not isinstance(obj, dict):
|
|
219
|
+
return cls.model_validate(obj)
|
|
220
|
+
|
|
221
|
+
obj = _cast(
|
|
222
|
+
Dict[str, Any],
|
|
223
|
+
cls.__preprocess_input_names(
|
|
224
|
+
obj,
|
|
225
|
+
remove_hidden_storage_names=True,
|
|
226
|
+
),
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
_obj = cls.model_validate({
|
|
230
|
+
"canPublish": obj.get("canPublish") if obj.get("canPublish") is not None else True
|
|
231
|
+
})
|
|
232
|
+
return _obj
|
|
233
|
+
|
|
234
|
+
|
vrchatapi/py.typed
ADDED
|
File without changes
|
vrchatapi/rest.py
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
VRChat API Documentation
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
The version of the OpenAPI document: 1.20.8
|
|
8
|
+
Contact: vrchatapi.lpv0t@aries.fyi
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
import io
|
|
16
|
+
import json
|
|
17
|
+
import re
|
|
18
|
+
import ssl
|
|
19
|
+
from typing import Any, Dict, Optional, Union
|
|
20
|
+
|
|
21
|
+
import aiohttp
|
|
22
|
+
import aiohttp_retry
|
|
23
|
+
|
|
24
|
+
from vrchatapi.exceptions import ApiException, ApiValueError
|
|
25
|
+
from http.cookiejar import CookieJar
|
|
26
|
+
from urllib.request import Request as _UrlLibRequest
|
|
27
|
+
|
|
28
|
+
RESTResponseType = aiohttp.ClientResponse
|
|
29
|
+
|
|
30
|
+
ALLOW_RETRY_METHODS = frozenset({'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PUT', 'TRACE'})
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class _CookieHeaderAdapter:
|
|
34
|
+
"""Minimal ``email.message``-like view over aiohttp headers for http.cookiejar."""
|
|
35
|
+
|
|
36
|
+
def __init__(self, headers) -> None:
|
|
37
|
+
self._headers = headers
|
|
38
|
+
|
|
39
|
+
def get_all(self, name, default=None):
|
|
40
|
+
return self._headers.getall(name, default)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class _CookieResponseAdapter:
|
|
44
|
+
"""Adapter exposing ``info()`` so ``CookieJar.extract_cookies`` works with aiohttp."""
|
|
45
|
+
|
|
46
|
+
def __init__(self, headers) -> None:
|
|
47
|
+
self._headers = headers
|
|
48
|
+
|
|
49
|
+
def info(self):
|
|
50
|
+
return _CookieHeaderAdapter(self._headers)
|
|
51
|
+
|
|
52
|
+
class RESTResponse(io.IOBase):
|
|
53
|
+
|
|
54
|
+
def __init__(self, resp) -> None:
|
|
55
|
+
self.response = resp
|
|
56
|
+
self.status = resp.status
|
|
57
|
+
self.reason = resp.reason
|
|
58
|
+
self.data = None
|
|
59
|
+
|
|
60
|
+
async def read(self):
|
|
61
|
+
if self.data is None:
|
|
62
|
+
self.data = await self.response.read()
|
|
63
|
+
return self.data
|
|
64
|
+
|
|
65
|
+
@property
|
|
66
|
+
def headers(self):
|
|
67
|
+
"""Returns a CIMultiDictProxy of response headers."""
|
|
68
|
+
return self.response.headers
|
|
69
|
+
|
|
70
|
+
def getheaders(self):
|
|
71
|
+
"""Returns a CIMultiDictProxy of the response headers; use ``headers`` instead."""
|
|
72
|
+
return self.response.headers
|
|
73
|
+
|
|
74
|
+
def getheader(self, name, default=None):
|
|
75
|
+
"""Returns a given response header; use ``headers.get()`` instead."""
|
|
76
|
+
return self.response.headers.get(name, default)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class RESTClientObject:
|
|
80
|
+
|
|
81
|
+
def __init__(self, configuration) -> None:
|
|
82
|
+
|
|
83
|
+
# Keep a reference so factory methods (_create_pool_manager / _create_connector)
|
|
84
|
+
# and subclasses can read extension fields like trace_configs.
|
|
85
|
+
self.configuration = configuration
|
|
86
|
+
|
|
87
|
+
# maxsize is number of requests to host that are allowed in parallel
|
|
88
|
+
self.maxsize = configuration.connection_pool_maxsize
|
|
89
|
+
|
|
90
|
+
self.ssl_context = ssl.create_default_context(
|
|
91
|
+
cafile=configuration.ssl_ca_cert,
|
|
92
|
+
cadata=configuration.ca_cert_data,
|
|
93
|
+
)
|
|
94
|
+
if configuration.cert_file:
|
|
95
|
+
self.ssl_context.load_cert_chain(
|
|
96
|
+
configuration.cert_file, keyfile=configuration.key_file
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
if not configuration.verify_ssl:
|
|
100
|
+
self.ssl_context.check_hostname = False
|
|
101
|
+
self.ssl_context.verify_mode = ssl.CERT_NONE
|
|
102
|
+
|
|
103
|
+
self.proxy = configuration.proxy
|
|
104
|
+
self.proxy_headers = configuration.proxy_headers
|
|
105
|
+
|
|
106
|
+
retries = configuration.retries
|
|
107
|
+
if retries is None:
|
|
108
|
+
self._effective_retry_options = None
|
|
109
|
+
elif isinstance(retries, aiohttp_retry.RetryOptionsBase):
|
|
110
|
+
self._effective_retry_options = retries
|
|
111
|
+
elif isinstance(retries, int):
|
|
112
|
+
self._effective_retry_options = aiohttp_retry.ExponentialRetry(
|
|
113
|
+
attempts=retries,
|
|
114
|
+
factor=2.0,
|
|
115
|
+
start_timeout=0.1,
|
|
116
|
+
max_timeout=120.0
|
|
117
|
+
)
|
|
118
|
+
else:
|
|
119
|
+
self._effective_retry_options = None
|
|
120
|
+
|
|
121
|
+
self.pool_manager: Optional[aiohttp.ClientSession] = None
|
|
122
|
+
self.retry_client: Optional[aiohttp_retry.RetryClient] = None
|
|
123
|
+
|
|
124
|
+
# VRChatAPI: Init global cookie storage
|
|
125
|
+
self.cookie_jar = CookieJar()
|
|
126
|
+
|
|
127
|
+
async def close(self) -> None:
|
|
128
|
+
if self.pool_manager:
|
|
129
|
+
await self.pool_manager.close()
|
|
130
|
+
if self.retry_client is not None:
|
|
131
|
+
await self.retry_client.close()
|
|
132
|
+
|
|
133
|
+
def _create_connector(self) -> aiohttp.TCPConnector:
|
|
134
|
+
"""Build the TCPConnector used by the ClientSession.
|
|
135
|
+
|
|
136
|
+
Override in a subclass to customize DNS resolver, keepalive, etc.
|
|
137
|
+
"""
|
|
138
|
+
kwargs: Dict[str, Any] = {
|
|
139
|
+
"limit": self.maxsize,
|
|
140
|
+
"ssl": self.ssl_context,
|
|
141
|
+
}
|
|
142
|
+
limit_per_host = getattr(self.configuration, "tcp_connector_limit_per_host", None)
|
|
143
|
+
if limit_per_host is not None:
|
|
144
|
+
kwargs["limit_per_host"] = limit_per_host
|
|
145
|
+
return aiohttp.TCPConnector(**kwargs)
|
|
146
|
+
|
|
147
|
+
def _create_pool_manager(self) -> aiohttp.ClientSession:
|
|
148
|
+
"""Build the aiohttp.ClientSession used as the connection pool.
|
|
149
|
+
|
|
150
|
+
Override in a subclass to fully customize the session (e.g. attach
|
|
151
|
+
aiohttp.TraceConfig, swap json_serialize, etc.). Typed Configuration
|
|
152
|
+
fields (trace_configs / client_session_kwargs) are read via getattr
|
|
153
|
+
so older Configuration objects remain compatible.
|
|
154
|
+
"""
|
|
155
|
+
extra = getattr(self.configuration, "client_session_kwargs", None)
|
|
156
|
+
kwargs: Dict[str, Any] = {
|
|
157
|
+
"connector": self._create_connector(),
|
|
158
|
+
"trust_env": False,
|
|
159
|
+
}
|
|
160
|
+
trace_configs = getattr(self.configuration, "trace_configs", None)
|
|
161
|
+
if trace_configs is not None:
|
|
162
|
+
kwargs["trace_configs"] = trace_configs
|
|
163
|
+
if extra:
|
|
164
|
+
kwargs.update(extra)
|
|
165
|
+
return aiohttp.ClientSession(**kwargs)
|
|
166
|
+
|
|
167
|
+
async def request(
|
|
168
|
+
self,
|
|
169
|
+
method,
|
|
170
|
+
url,
|
|
171
|
+
headers=None,
|
|
172
|
+
body=None,
|
|
173
|
+
post_params=None,
|
|
174
|
+
_request_timeout=None
|
|
175
|
+
):
|
|
176
|
+
"""Execute request
|
|
177
|
+
|
|
178
|
+
:param method: http request method
|
|
179
|
+
:param url: http request url
|
|
180
|
+
:param headers: http request headers
|
|
181
|
+
:param body: request json body, for `application/json`
|
|
182
|
+
:param post_params: request post parameters,
|
|
183
|
+
`application/x-www-form-urlencoded`
|
|
184
|
+
and `multipart/form-data`
|
|
185
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
186
|
+
number provided, it will be total request
|
|
187
|
+
timeout. It can also be a pair (tuple) of
|
|
188
|
+
(connection, read) timeouts.
|
|
189
|
+
"""
|
|
190
|
+
method = method.upper()
|
|
191
|
+
assert method in [
|
|
192
|
+
'GET',
|
|
193
|
+
'HEAD',
|
|
194
|
+
'DELETE',
|
|
195
|
+
'POST',
|
|
196
|
+
'PUT',
|
|
197
|
+
'PATCH',
|
|
198
|
+
'OPTIONS'
|
|
199
|
+
]
|
|
200
|
+
|
|
201
|
+
if post_params and body:
|
|
202
|
+
raise ApiValueError(
|
|
203
|
+
"body parameter cannot be used with post_params parameter."
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
post_params = post_params or {}
|
|
207
|
+
headers = headers or {}
|
|
208
|
+
# url already contains the URL query string
|
|
209
|
+
if isinstance(_request_timeout, tuple) and len(_request_timeout) == 2:
|
|
210
|
+
timeout = aiohttp.ClientTimeout(
|
|
211
|
+
connect=_request_timeout[0],
|
|
212
|
+
sock_read=_request_timeout[1],
|
|
213
|
+
)
|
|
214
|
+
else:
|
|
215
|
+
timeout = aiohttp.ClientTimeout(total=_request_timeout or 5 * 60)
|
|
216
|
+
|
|
217
|
+
if 'Content-Type' not in headers:
|
|
218
|
+
headers['Content-Type'] = 'application/json'
|
|
219
|
+
|
|
220
|
+
args = {
|
|
221
|
+
"method": method,
|
|
222
|
+
"url": url,
|
|
223
|
+
"timeout": timeout,
|
|
224
|
+
"headers": headers
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if self.proxy:
|
|
228
|
+
args["proxy"] = self.proxy
|
|
229
|
+
if self.proxy_headers:
|
|
230
|
+
args["proxy_headers"] = self.proxy_headers
|
|
231
|
+
|
|
232
|
+
# For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
|
|
233
|
+
if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
|
|
234
|
+
if re.search('json', headers['Content-Type'], re.IGNORECASE):
|
|
235
|
+
if body is not None:
|
|
236
|
+
body = json.dumps(body)
|
|
237
|
+
if body is None and post_params:
|
|
238
|
+
body = json.dumps(dict(post_params))
|
|
239
|
+
args["data"] = body
|
|
240
|
+
elif headers['Content-Type'] == 'application/x-www-form-urlencoded':
|
|
241
|
+
args["data"] = aiohttp.FormData(post_params)
|
|
242
|
+
elif headers['Content-Type'] == 'multipart/form-data':
|
|
243
|
+
# must del headers['Content-Type'], or the correct
|
|
244
|
+
# Content-Type which generated by aiohttp
|
|
245
|
+
del headers['Content-Type']
|
|
246
|
+
data = aiohttp.FormData()
|
|
247
|
+
for param in post_params:
|
|
248
|
+
k, v = param
|
|
249
|
+
if isinstance(v, tuple) and len(v) == 3:
|
|
250
|
+
data.add_field(
|
|
251
|
+
k,
|
|
252
|
+
value=v[1],
|
|
253
|
+
filename=v[0],
|
|
254
|
+
content_type=v[2]
|
|
255
|
+
)
|
|
256
|
+
else:
|
|
257
|
+
# Ensures that dict objects are serialized
|
|
258
|
+
if isinstance(v, dict):
|
|
259
|
+
v = json.dumps(v)
|
|
260
|
+
elif isinstance(v, int):
|
|
261
|
+
v = str(v)
|
|
262
|
+
data.add_field(k, v)
|
|
263
|
+
args["data"] = data
|
|
264
|
+
|
|
265
|
+
# Pass a `bytes` or `str` parameter directly in the body to support
|
|
266
|
+
# other content types than Json when `body` argument is provided
|
|
267
|
+
# in serialized form
|
|
268
|
+
elif isinstance(body, str) or isinstance(body, bytes):
|
|
269
|
+
args["data"] = body
|
|
270
|
+
else:
|
|
271
|
+
# Cannot generate the request from given parameters
|
|
272
|
+
msg = """Cannot prepare a request message for provided
|
|
273
|
+
arguments. Please check that your arguments match
|
|
274
|
+
declared content type."""
|
|
275
|
+
raise ApiException(status=0, reason=msg)
|
|
276
|
+
|
|
277
|
+
pool_manager: Union[aiohttp.ClientSession, aiohttp_retry.RetryClient]
|
|
278
|
+
|
|
279
|
+
# https pool manager
|
|
280
|
+
if self.pool_manager is None:
|
|
281
|
+
self.pool_manager = self._create_pool_manager()
|
|
282
|
+
pool_manager = self.pool_manager
|
|
283
|
+
|
|
284
|
+
if self._effective_retry_options is not None and method in ALLOW_RETRY_METHODS:
|
|
285
|
+
if self.retry_client is None:
|
|
286
|
+
self.retry_client = aiohttp_retry.RetryClient(
|
|
287
|
+
client_session=self.pool_manager,
|
|
288
|
+
retry_options=self._effective_retry_options
|
|
289
|
+
)
|
|
290
|
+
pool_manager = self.retry_client
|
|
291
|
+
|
|
292
|
+
# VRChatAPI: Attach session cookies to the outgoing request
|
|
293
|
+
mock_request_object = _UrlLibRequest(url=url, method=method, headers=headers)
|
|
294
|
+
self.cookie_jar.add_cookie_header(mock_request_object)
|
|
295
|
+
if "Cookie" in mock_request_object.unredirected_hdrs:
|
|
296
|
+
headers["Cookie"] = mock_request_object.unredirected_hdrs["Cookie"]
|
|
297
|
+
|
|
298
|
+
r = await pool_manager.request(**args)
|
|
299
|
+
|
|
300
|
+
# VRChatAPI: Store any cookies set by the response for later requests
|
|
301
|
+
self.cookie_jar.extract_cookies(_CookieResponseAdapter(r.headers), mock_request_object)
|
|
302
|
+
|
|
303
|
+
return RESTResponse(r)
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vrchatapi-async
|
|
3
|
+
Version: 1.20.8.dev1
|
|
4
|
+
Summary: VRChat API Library for Python (async version)
|
|
5
|
+
Home-page: https://github.com/hi94740/vrchatapi-python-async
|
|
6
|
+
Author: hi94740
|
|
7
|
+
Author-email: hi94740@qq.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: vrchat,vrchatapi,vrc
|
|
10
|
+
Requires-Python: >=3.10
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: python-dateutil>=2.8.2
|
|
14
|
+
Requires-Dist: aiohttp>=3.13.5
|
|
15
|
+
Requires-Dist: aiohttp-retry>=2.8.3
|
|
16
|
+
Requires-Dist: pydantic>=2.11
|
|
17
|
+
Requires-Dist: typing-extensions>=4.7.1
|
|
18
|
+
Dynamic: author
|
|
19
|
+
Dynamic: author-email
|
|
20
|
+
Dynamic: description
|
|
21
|
+
Dynamic: description-content-type
|
|
22
|
+
Dynamic: home-page
|
|
23
|
+
Dynamic: keywords
|
|
24
|
+
Dynamic: license
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
Dynamic: requires-dist
|
|
27
|
+
Dynamic: requires-python
|
|
28
|
+
Dynamic: summary
|
|
29
|
+
|
|
30
|
+

|
|
31
|
+
|
|
32
|
+
# VRChat API Library for Python (async)
|
|
33
|
+
|
|
34
|
+
A Python client to interact with the unofficial VRChat API. Supports all REST calls specified in the [API specification](https://github.com/vrchatapi/specification).
|
|
35
|
+
|
|
36
|
+
This is an **asynchronous** (asyncio + aiohttp) adaptation of [VRChatAPI-Python](https://github.com/vrchatapi/vrchatapi-python). All API
|
|
37
|
+
methods are coroutines and must be awaited.
|
|
38
|
+
|
|
39
|
+
## Disclaimer
|
|
40
|
+
|
|
41
|
+
This is the official response of the VRChat Team (from Tupper more specifically) on the usage of the VRChat API.
|
|
42
|
+
|
|
43
|
+
> Use of the API using applications other than the approved methods (website, VRChat application) are not officially supported. You may use the API for your own application, but keep these guidelines in mind:
|
|
44
|
+
> * We do not provide documentation or support for the API.
|
|
45
|
+
> * Do not make queries to the API more than once per 60 seconds.
|
|
46
|
+
> * Abuse of the API may result in account termination.
|
|
47
|
+
> * Access to API endpoints may break at any given time, with no warning.
|
|
48
|
+
|
|
49
|
+
As stated, this documentation was not created with the help of the official VRChat team. Therefore this documentation is not an official documentation of the VRChat API and may not be always up to date with the latest versions. If you find that a page or endpoint is not longer valid please create an issue and tell us so we can fix it.
|
|
50
|
+
|
|
51
|
+
## Getting Started
|
|
52
|
+
|
|
53
|
+
First add the package to to your project:
|
|
54
|
+
```bash
|
|
55
|
+
pip install vrchatapi-async
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Below is an example on how to login to the API and fetch your own user information.
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
import asyncio
|
|
62
|
+
|
|
63
|
+
# Step 1. We begin with creating a Configuration, which contains the username and password for authentication.
|
|
64
|
+
import vrchatapi
|
|
65
|
+
from vrchatapi.api import authentication_api
|
|
66
|
+
from vrchatapi.exceptions import UnauthorizedException
|
|
67
|
+
from vrchatapi.models.two_factor_auth_code import TwoFactorAuthCode
|
|
68
|
+
from vrchatapi.models.two_factor_email_code import TwoFactorEmailCode
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
async def main():
|
|
72
|
+
configuration = vrchatapi.Configuration(
|
|
73
|
+
username = 'username',
|
|
74
|
+
password = 'password',
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
# Step 2. VRChat consists of several API's (WorldsApi, UsersApi, FilesApi, NotificationsApi, FriendsApi, etc...)
|
|
78
|
+
# Here we enter a context of the API Client and instantiate the Authentication API which is required for logging in.
|
|
79
|
+
|
|
80
|
+
# Enter a context with an instance of the API client
|
|
81
|
+
async with vrchatapi.ApiClient(configuration) as api_client:
|
|
82
|
+
# Set our User-Agent as per VRChat Usage Policy
|
|
83
|
+
api_client.user_agent = "ExampleProgram/0.0.1 my@email.com"
|
|
84
|
+
|
|
85
|
+
# Instantiate instances of API classes
|
|
86
|
+
auth_api = authentication_api.AuthenticationApi(api_client)
|
|
87
|
+
|
|
88
|
+
try:
|
|
89
|
+
# Step 3. Calling getCurrentUser on Authentication API logs you in if the user isn't already logged in.
|
|
90
|
+
current_user = await auth_api.get_current_user()
|
|
91
|
+
except UnauthorizedException as e:
|
|
92
|
+
if e.status == 200:
|
|
93
|
+
if "Email 2 Factor Authentication" in e.reason:
|
|
94
|
+
# Step 3.5. Calling email verify2fa if the account has 2FA disabled
|
|
95
|
+
await auth_api.verify2_fa_email_code(two_factor_email_code=TwoFactorEmailCode(input("Email 2FA Code: ")))
|
|
96
|
+
elif "2 Factor Authentication" in e.reason:
|
|
97
|
+
# Step 3.5. Calling verify2fa if the account has 2FA enabled
|
|
98
|
+
await auth_api.verify2_fa(two_factor_auth_code=TwoFactorAuthCode(input("2FA Code: ")))
|
|
99
|
+
current_user = await auth_api.get_current_user()
|
|
100
|
+
else:
|
|
101
|
+
print("Exception when calling API: %s
|
|
102
|
+
", e)
|
|
103
|
+
except vrchatapi.ApiException as e:
|
|
104
|
+
print("Exception when calling API: %s
|
|
105
|
+
", e)
|
|
106
|
+
|
|
107
|
+
print("Logged in as:", current_user.display_name)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
if __name__ == "__main__":
|
|
111
|
+
asyncio.run(main())
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
See [Examples](examples/README.md) for more example usage on getting started.
|
|
115
|
+
|
|
116
|
+
## Async API notes
|
|
117
|
+
|
|
118
|
+
Compared to [the synchronous SDK](https://github.com/vrchatapi/vrchatapi-python), this version changes the calling convention:
|
|
119
|
+
|
|
120
|
+
- Every API method (`foo`, `foo_with_http_info`, `foo_without_preload_content`)
|
|
121
|
+
is an `async def` coroutine and must be awaited.
|
|
122
|
+
- `ApiClient` is used as an async context manager (`async with ... as api_client`).
|
|
123
|
+
- The `async_req` parameter and the thread-pool based `async_req=True` usage are
|
|
124
|
+
removed; calls are natively asynchronous.
|
|
125
|
+
- `foo_with_http_info()` returns an `ApiResponse` object (`status_code`,
|
|
126
|
+
`headers`, `data`, `raw_data`) instead of a `(data, status, headers)` tuple.
|
|
127
|
+
- `foo_without_preload_content()` returns the raw aiohttp response for
|
|
128
|
+
streaming; the legacy `_preload_content=False` parameter is removed.
|
|
129
|
+
- The session `CookieJar`, the readable 2FA errors
|
|
130
|
+
(`UnauthorizedException` with status 200), the URL-encoded basic auth, the
|
|
131
|
+
`~()` safe path-parameter charset and the lowercase boolean query parameters
|
|
132
|
+
behave exactly like the synchronous SDK.
|
|
133
|
+
|
|
134
|
+
## Contributing
|
|
135
|
+
|
|
136
|
+
Contributions are welcome, but do not add features that should be handled by the OpenAPI specification.
|
|
137
|
+
|