diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index c12d03d..873d216 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -12,6 +12,7 @@ docs/AuthenticationApi.md docs/Avatar.md docs/AvatarUnityPackageUrlObject.md docs/AvatarsApi.md +docs/Badge.md docs/BanGroupMemberRequest.md docs/CreateAvatarRequest.md docs/CreateFileRequest.md @@ -19,8 +20,10 @@ docs/CreateFileVersionRequest.md docs/CreateGroupAnnouncementRequest.md docs/CreateGroupGalleryRequest.md docs/CreateGroupInviteRequest.md +docs/CreateGroupPostRequest.md docs/CreateGroupRequest.md docs/CreateGroupRoleRequest.md +docs/CreateInstanceRequest.md docs/CreateWorldRequest.md docs/CurrentUser.md docs/CurrentUserPresence.md @@ -45,10 +48,13 @@ docs/FinishFileDataUploadRequest.md docs/FriendStatus.md docs/FriendsApi.md docs/Group.md +docs/GroupAccessType.md docs/GroupAnnouncement.md docs/GroupAuditLogEntry.md docs/GroupGallery.md docs/GroupGalleryImage.md +docs/GroupInstance.md +docs/GroupJoinRequestAction.md docs/GroupJoinState.md docs/GroupLimitedMember.md docs/GroupMember.md @@ -56,9 +62,12 @@ docs/GroupMemberLimitedUser.md docs/GroupMemberStatus.md docs/GroupMyMember.md docs/GroupPermission.md +docs/GroupPost.md +docs/GroupPostVisibility.md docs/GroupPrivacy.md docs/GroupRole.md docs/GroupRoleTemplate.md +docs/GroupSearchSort.md docs/GroupUserVisibility.md docs/GroupsApi.md docs/InfoPush.md @@ -68,6 +77,7 @@ docs/InfoPushDataArticleContent.md docs/InfoPushDataClickable.md docs/Instance.md docs/InstancePlatforms.md +docs/InstanceRegion.md docs/InstanceShortNameResponse.md docs/InstanceType.md docs/InstancesApi.md @@ -80,12 +90,19 @@ docs/License.md docs/LicenseAction.md docs/LicenseGroup.md docs/LicenseType.md +docs/LimitedGroup.md docs/LimitedUnityPackage.md docs/LimitedUser.md +docs/LimitedUserGroups.md docs/LimitedWorld.md docs/MimeType.md docs/ModerateUserRequest.md docs/Notification.md +docs/NotificationDetailInvite.md +docs/NotificationDetailInviteResponse.md +docs/NotificationDetailRequestInvite.md +docs/NotificationDetailRequestInviteResponse.md +docs/NotificationDetailVoteToKick.md docs/NotificationType.md docs/NotificationsApi.md docs/OrderOption.md @@ -98,6 +115,7 @@ docs/PlayerModerationType.md docs/PlayermoderationApi.md docs/Region.md docs/ReleaseStatus.md +docs/RepresentedGroup.md docs/RequestInviteRequest.md docs/RespondGroupJoinRequest.md docs/Response.md @@ -166,6 +184,7 @@ src/models/api_config_events.rs src/models/api_health.rs src/models/avatar.rs src/models/avatar_unity_package_url_object.rs +src/models/badge.rs src/models/ban_group_member_request.rs src/models/create_avatar_request.rs src/models/create_file_request.rs @@ -173,8 +192,10 @@ src/models/create_file_version_request.rs src/models/create_group_announcement_request.rs src/models/create_group_gallery_request.rs src/models/create_group_invite_request.rs +src/models/create_group_post_request.rs src/models/create_group_request.rs src/models/create_group_role_request.rs +src/models/create_instance_request.rs src/models/create_world_request.rs src/models/current_user.rs src/models/current_user_presence.rs @@ -195,10 +216,13 @@ src/models/file_version_upload_status.rs src/models/finish_file_data_upload_request.rs src/models/friend_status.rs src/models/group.rs +src/models/group_access_type.rs src/models/group_announcement.rs src/models/group_audit_log_entry.rs src/models/group_gallery.rs src/models/group_gallery_image.rs +src/models/group_instance.rs +src/models/group_join_request_action.rs src/models/group_join_state.rs src/models/group_limited_member.rs src/models/group_member.rs @@ -206,9 +230,12 @@ src/models/group_member_limited_user.rs src/models/group_member_status.rs src/models/group_my_member.rs src/models/group_permission.rs +src/models/group_post.rs +src/models/group_post_visibility.rs src/models/group_privacy.rs src/models/group_role.rs src/models/group_role_template.rs +src/models/group_search_sort.rs src/models/group_user_visibility.rs src/models/info_push.rs src/models/info_push_data.rs @@ -217,6 +244,7 @@ src/models/info_push_data_article_content.rs src/models/info_push_data_clickable.rs src/models/instance.rs src/models/instance_platforms.rs +src/models/instance_region.rs src/models/instance_short_name_response.rs src/models/instance_type.rs src/models/invite_message.rs @@ -227,13 +255,20 @@ src/models/license.rs src/models/license_action.rs src/models/license_group.rs src/models/license_type.rs +src/models/limited_group.rs src/models/limited_unity_package.rs src/models/limited_user.rs +src/models/limited_user_groups.rs src/models/limited_world.rs src/models/mime_type.rs src/models/mod.rs src/models/moderate_user_request.rs src/models/notification.rs +src/models/notification_detail_invite.rs +src/models/notification_detail_invite_response.rs +src/models/notification_detail_request_invite.rs +src/models/notification_detail_request_invite_response.rs +src/models/notification_detail_vote_to_kick.rs src/models/notification_type.rs src/models/order_option.rs src/models/paginated_group_audit_log_entry_list.rs @@ -243,6 +278,7 @@ src/models/player_moderation.rs src/models/player_moderation_type.rs src/models/region.rs src/models/release_status.rs +src/models/represented_group.rs src/models/request_invite_request.rs src/models/respond_group_join_request.rs src/models/response.rs diff --git a/Cargo.toml b/Cargo.toml index 161c3d2..a635134 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "vrchatapi" -version = "1.15.0" +version = "1.17.5" authors = ["vrchatapi.lpv0t@aries.fyi"] description = "VRChat API Client for Rust" license = "MIT" @@ -13,4 +13,11 @@ serde_with = "^2.0" serde_json = "^1.0" url = "^2.2" uuid = { version = "^1.0", features = ["serde"] } -reqwest = "~0.9" +[dependencies.reqwest] +version = "^0.11" +features = ["json", "cookies", "multipart"] + +[dev-dependencies] +tokio = { version = '1', features = ['macros', 'rt-multi-thread'] } +[dependencies.log] +version = "0.4" diff --git a/docs/AuthenticationApi.md b/docs/AuthenticationApi.md index b6618b8..2198348 100644 --- a/docs/AuthenticationApi.md +++ b/docs/AuthenticationApi.md @@ -1,6 +1,6 @@ # \AuthenticationApi -All URIs are relative to *https://api.vrchat.cloud/api/1* +All URIs are relative to *https://vrchat.com/api/1* Method | HTTP request | Description ------------- | ------------- | ------------- @@ -144,7 +144,7 @@ Finishes the login sequence with a normal 2FA-generated code for accounts with 2 Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**two_factor_auth_code** | Option<[**TwoFactorAuthCode**](TwoFactorAuthCode.md)> | | | +**two_factor_auth_code** | [**TwoFactorAuthCode**](TwoFactorAuthCode.md) | | [required] | ### Return type @@ -174,7 +174,7 @@ Finishes the login sequence with an 2FA email code. Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**two_factor_email_code** | Option<[**TwoFactorEmailCode**](TwoFactorEmailCode.md)> | | | +**two_factor_email_code** | [**TwoFactorEmailCode**](TwoFactorEmailCode.md) | | [required] | ### Return type @@ -231,7 +231,7 @@ Finishes the login sequence with an OTP (One Time Password) recovery code for ac Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**two_factor_auth_code** | Option<[**TwoFactorAuthCode**](TwoFactorAuthCode.md)> | | | +**two_factor_auth_code** | [**TwoFactorAuthCode**](TwoFactorAuthCode.md) | | [required] | ### Return type diff --git a/docs/AvatarsApi.md b/docs/AvatarsApi.md index 3aba20c..052a76f 100644 --- a/docs/AvatarsApi.md +++ b/docs/AvatarsApi.md @@ -1,6 +1,6 @@ # \AvatarsApi -All URIs are relative to *https://api.vrchat.cloud/api/1* +All URIs are relative to *https://vrchat.com/api/1* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/docs/Badge.md b/docs/Badge.md new file mode 100644 index 0000000..bd2f338 --- /dev/null +++ b/docs/Badge.md @@ -0,0 +1,18 @@ +# Badge + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**assigned_at** | Option<**String**> | only present in CurrentUser badges | [optional] +**badge_description** | **String** | | +**badge_id** | **String** | | +**badge_image_url** | **String** | direct url to image | +**badge_name** | **String** | | +**hidden** | Option<**bool**> | only present in CurrentUser badges | [optional] +**showcased** | **bool** | | +**updated_at** | Option<**String**> | only present in CurrentUser badges | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CreateAvatarRequest.md b/docs/CreateAvatarRequest.md index 9453f79..af2818d 100644 --- a/docs/CreateAvatarRequest.md +++ b/docs/CreateAvatarRequest.md @@ -13,6 +13,7 @@ Name | Type | Description | Notes **release_status** | Option<[**crate::models::ReleaseStatus**](ReleaseStatus.md)> | | [optional] **version** | Option<**f32**> | | [optional][default to 1] **unity_package_url** | Option<**String**> | | [optional] +**unity_version** | Option<**String**> | | [optional][default to 5.3.4p1] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/CreateGroupPostRequest.md b/docs/CreateGroupPostRequest.md new file mode 100644 index 0000000..6fe9149 --- /dev/null +++ b/docs/CreateGroupPostRequest.md @@ -0,0 +1,16 @@ +# CreateGroupPostRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **String** | Post title | +**text** | **String** | Post text | +**image_id** | Option<**String**> | | [optional] +**send_notification** | **bool** | Send notification to group members. | [default to false] +**role_ids** | Option<**Vec**> | | [optional] +**visibility** | [**crate::models::GroupPostVisibility**](GroupPostVisibility.md) | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CreateInstanceRequest.md b/docs/CreateInstanceRequest.md new file mode 100644 index 0000000..bde91f0 --- /dev/null +++ b/docs/CreateInstanceRequest.md @@ -0,0 +1,21 @@ +# CreateInstanceRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**world_id** | **String** | WorldID be \"offline\" on User profiles if you are not friends with that user. | +**r#type** | [**crate::models::InstanceType**](InstanceType.md) | | +**region** | [**crate::models::InstanceRegion**](InstanceRegion.md) | | +**owner_id** | Option<**String**> | A groupId if the instance type is \"group\", null if instance type is public, or a userId otherwise | [optional] +**role_ids** | Option<**Vec**> | Group roleIds that are allowed to join if the type is \"group\" and groupAccessType is \"member\" | [optional] +**group_access_type** | Option<[**crate::models::GroupAccessType**](GroupAccessType.md)> | | [optional] +**queue_enabled** | Option<**bool**> | | [optional][default to false] +**closed_at** | Option<**String**> | The time after which users won't be allowed to join the instance. This doesn't work for public instances. | [optional] +**can_request_invite** | Option<**bool**> | Only applies to invite type instances to make them invite+ | [optional][default to false] +**hard_close** | Option<**bool**> | Currently unused, but will eventually be a flag to set if the closing of the instance should kick people. | [optional][default to false] +**invite_only** | Option<**bool**> | | [optional][default to false] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CurrentUser.md b/docs/CurrentUser.md index b0994c7..f3f13a6 100644 --- a/docs/CurrentUser.md +++ b/docs/CurrentUser.md @@ -10,12 +10,14 @@ Name | Type | Description | Notes **account_deletion_log** | Option<[**Vec**](AccountDeletionLog.md)> | | [optional] **active_friends** | Option<**Vec**> | | [optional] **allow_avatar_copying** | **bool** | | +**badges** | Option<[**Vec**](Badge.md)> | | [optional] **bio** | **String** | | **bio_links** | **Vec** | | **current_avatar** | **String** | | **current_avatar_asset_url** | **String** | | **current_avatar_image_url** | **String** | When profilePicOverride is not empty, use it instead. | **current_avatar_thumbnail_image_url** | **String** | When profilePicOverride is not empty, use it instead. | +**current_avatar_tags** | **Vec** | | **date_joined** | [**String**](string.md) | | **developer_type** | [**crate::models::DeveloperType**](DeveloperType.md) | | **display_name** | **String** | | @@ -25,6 +27,9 @@ Name | Type | Description | Notes **friend_key** | **String** | | **friends** | **Vec** | | **has_birthday** | **bool** | | +**hide_content_filter_settings** | Option<**bool**> | | [optional] +**user_language** | Option<**String**> | | [optional] +**user_language_code** | Option<**String**> | | [optional] **has_email** | **bool** | | **has_logged_in_from_client** | **bool** | | **has_pending_email** | **bool** | | @@ -33,15 +38,21 @@ Name | Type | Description | Notes **is_friend** | **bool** | | [default to false] **last_activity** | Option<**String**> | | [optional] **last_login** | **String** | | +**last_mobile** | Option<**String**> | | **last_platform** | **String** | This can be `standalonewindows` or `android`, but can also pretty much be any random Unity verison such as `2019.2.4-801-Release` or `2019.2.2-772-Release` or even `unknownplatform`. | **obfuscated_email** | **String** | | **obfuscated_pending_email** | **String** | | **oculus_id** | **String** | | +**google_id** | Option<**String**> | | [optional] +**google_details** | Option<[**serde_json::Value**](.md)> | | [optional] +**pico_id** | Option<**String**> | | [optional] +**vive_id** | Option<**String**> | | [optional] **offline_friends** | Option<**Vec**> | | [optional] **online_friends** | Option<**Vec**> | | [optional] **past_display_names** | [**Vec**](PastDisplayName.md) | | **presence** | Option<[**crate::models::CurrentUserPresence**](CurrentUserPresence.md)> | | [optional] **profile_pic_override** | **String** | | +**pronouns** | **String** | | **state** | [**crate::models::UserState**](UserState.md) | | **status** | [**crate::models::UserStatus**](UserStatus.md) | | **status_description** | **String** | | diff --git a/docs/EconomyApi.md b/docs/EconomyApi.md index eb4b3c6..21baf74 100644 --- a/docs/EconomyApi.md +++ b/docs/EconomyApi.md @@ -1,6 +1,6 @@ # \EconomyApi -All URIs are relative to *https://api.vrchat.cloud/api/1* +All URIs are relative to *https://vrchat.com/api/1* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/docs/FavoritesApi.md b/docs/FavoritesApi.md index b9333e0..19db4d6 100644 --- a/docs/FavoritesApi.md +++ b/docs/FavoritesApi.md @@ -1,6 +1,6 @@ # \FavoritesApi -All URIs are relative to *https://api.vrchat.cloud/api/1* +All URIs are relative to *https://vrchat.com/api/1* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/docs/FilesApi.md b/docs/FilesApi.md index fa47ebb..131130b 100644 --- a/docs/FilesApi.md +++ b/docs/FilesApi.md @@ -1,6 +1,6 @@ # \FilesApi -All URIs are relative to *https://api.vrchat.cloud/api/1* +All URIs are relative to *https://vrchat.com/api/1* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/docs/FriendsApi.md b/docs/FriendsApi.md index 6720790..9f21807 100644 --- a/docs/FriendsApi.md +++ b/docs/FriendsApi.md @@ -1,6 +1,6 @@ # \FriendsApi -All URIs are relative to *https://api.vrchat.cloud/api/1* +All URIs are relative to *https://vrchat.com/api/1* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/docs/GroupAccessType.md b/docs/GroupAccessType.md new file mode 100644 index 0000000..fba5de8 --- /dev/null +++ b/docs/GroupAccessType.md @@ -0,0 +1,10 @@ +# GroupAccessType + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/GroupAuditLogEntry.md b/docs/GroupAuditLogEntry.md index 7f64dda..d938661 100644 --- a/docs/GroupAuditLogEntry.md +++ b/docs/GroupAuditLogEntry.md @@ -8,7 +8,7 @@ Name | Type | Description | Notes **created_at** | Option<**String**> | | [optional] **group_id** | Option<**String**> | | [optional] **actor_id** | Option<**String**> | A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. | [optional] -**actor_displayname** | Option<**String**> | | [optional] +**actor_display_name** | Option<**String**> | | [optional] **target_id** | Option<**String**> | Typically GroupID or GroupRoleID, but could be other types of IDs. | [optional] **event_type** | Option<**String**> | The type of event that occurred. This is a string that is prefixed with the type of object that the event occurred on. For example, a group role update event would be prefixed with `group.role`. | [optional][default to group.update] **description** | Option<**String**> | A human-readable description of the event. | [optional] diff --git a/docs/GroupInstance.md b/docs/GroupInstance.md new file mode 100644 index 0000000..a10fa9d --- /dev/null +++ b/docs/GroupInstance.md @@ -0,0 +1,14 @@ +# GroupInstance + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**instance_id** | **String** | | +**location** | **String** | InstanceID can be \"offline\" on User profiles if you are not friends with that user and \"private\" if you are friends and user is in private instance. | +**world** | [**crate::models::World**](World.md) | | +**member_count** | **i32** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/GroupJoinRequestAction.md b/docs/GroupJoinRequestAction.md new file mode 100644 index 0000000..778786c --- /dev/null +++ b/docs/GroupJoinRequestAction.md @@ -0,0 +1,10 @@ +# GroupJoinRequestAction + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/GroupLimitedMember.md b/docs/GroupLimitedMember.md index 4d2bef5..8ec3daa 100644 --- a/docs/GroupLimitedMember.md +++ b/docs/GroupLimitedMember.md @@ -7,7 +7,18 @@ Name | Type | Description | Notes **id** | Option<**String**> | | [optional] **group_id** | Option<**String**> | | [optional] **user_id** | Option<**String**> | A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. | [optional] -**is_representing** | Option<**bool**> | | [optional][default to false] +**is_representing** | Option<**bool**> | Whether the user is representing the group. This makes the group show up above the name tag in-game. | [optional][default to false] +**role_ids** | Option<**Vec**> | | [optional] +**m_role_ids** | Option<**Vec**> | | [optional] +**joined_at** | Option<**String**> | | [optional] +**membership_status** | Option<[**crate::models::GroupMemberStatus**](GroupMemberStatus.md)> | | [optional] +**visibility** | Option<**String**> | | [optional] +**is_subscribed_to_announcements** | Option<**bool**> | | [optional][default to false] +**created_at** | Option<**String**> | Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user. | [optional] +**banned_at** | Option<**String**> | Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user. | [optional] +**manager_notes** | Option<**String**> | Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user. | [optional] +**last_post_read_at** | Option<**String**> | | [optional] +**has_joined_from_purchase** | Option<**bool**> | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/GroupMember.md b/docs/GroupMember.md index f2d1310..1ca3e3b 100644 --- a/docs/GroupMember.md +++ b/docs/GroupMember.md @@ -10,13 +10,16 @@ Name | Type | Description | Notes **is_representing** | Option<**bool**> | Whether the user is representing the group. This makes the group show up above the name tag in-game. | [optional][default to false] **user** | Option<[**crate::models::GroupMemberLimitedUser**](GroupMemberLimitedUser.md)> | | [optional] **role_ids** | Option<**Vec**> | | [optional] +**m_role_ids** | Option<**Vec**> | | [optional] **joined_at** | Option<**String**> | | [optional] -**membership_status** | Option<**String**> | | [optional] +**membership_status** | Option<[**crate::models::GroupMemberStatus**](GroupMemberStatus.md)> | | [optional] **visibility** | Option<**String**> | | [optional] **is_subscribed_to_announcements** | Option<**bool**> | | [optional][default to false] **created_at** | Option<**String**> | Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user. | [optional] **banned_at** | Option<**String**> | Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user. | [optional] **manager_notes** | Option<**String**> | Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user. | [optional] +**last_post_read_at** | Option<**String**> | | [optional] +**has_joined_from_purchase** | Option<**bool**> | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/GroupMemberLimitedUser.md b/docs/GroupMemberLimitedUser.md index 5e106e6..88fa889 100644 --- a/docs/GroupMemberLimitedUser.md +++ b/docs/GroupMemberLimitedUser.md @@ -8,6 +8,9 @@ Name | Type | Description | Notes **display_name** | Option<**String**> | | [optional] **thumbnail_url** | Option<**String**> | | [optional] **icon_url** | Option<**String**> | | [optional] +**profile_pic_override** | Option<**String**> | | [optional] +**current_avatar_thumbnail_image_url** | Option<**String**> | | [optional] +**current_avatar_tags** | Option<**Vec**> | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/GroupPost.md b/docs/GroupPost.md new file mode 100644 index 0000000..6b1677e --- /dev/null +++ b/docs/GroupPost.md @@ -0,0 +1,22 @@ +# GroupPost + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | Option<**String**> | | [optional] +**group_id** | Option<**String**> | | [optional] +**author_id** | Option<**String**> | A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. | [optional] +**editor_id** | Option<**String**> | A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. | [optional] +**visibility** | Option<[**crate::models::GroupPostVisibility**](GroupPostVisibility.md)> | | [optional] +**role_id** | Option<**Vec**> | | [optional] +**title** | Option<**String**> | | [optional] +**text** | Option<**String**> | | [optional] +**image_id** | Option<**String**> | | [optional] +**image_url** | Option<**String**> | | [optional] +**created_at** | Option<**String**> | | [optional] +**updated_at** | Option<**String**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/GroupPostVisibility.md b/docs/GroupPostVisibility.md new file mode 100644 index 0000000..72c51fc --- /dev/null +++ b/docs/GroupPostVisibility.md @@ -0,0 +1,10 @@ +# GroupPostVisibility + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/GroupSearchSort.md b/docs/GroupSearchSort.md new file mode 100644 index 0000000..06fa1ae --- /dev/null +++ b/docs/GroupSearchSort.md @@ -0,0 +1,10 @@ +# GroupSearchSort + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/GroupsApi.md b/docs/GroupsApi.md index d429846..556465f 100644 --- a/docs/GroupsApi.md +++ b/docs/GroupsApi.md @@ -1,11 +1,12 @@ # \GroupsApi -All URIs are relative to *https://api.vrchat.cloud/api/1* +All URIs are relative to *https://vrchat.com/api/1* Method | HTTP request | Description ------------- | ------------- | ------------- [**add_group_gallery_image**](GroupsApi.md#add_group_gallery_image) | **POST** /groups/{groupId}/galleries/{groupGalleryId}/images | Add Group Gallery Image [**add_group_member_role**](GroupsApi.md#add_group_member_role) | **PUT** /groups/{groupId}/members/{userId}/roles/{groupRoleId} | Add Role to GroupMember +[**add_group_post**](GroupsApi.md#add_group_post) | **POST** /groups/{groupId}/posts | Create a post in a Group [**ban_group_member**](GroupsApi.md#ban_group_member) | **POST** /groups/{groupId}/bans | Ban Group Member [**cancel_group_request**](GroupsApi.md#cancel_group_request) | **DELETE** /groups/{groupId}/requests | Cancel Group Join Request [**create_group**](GroupsApi.md#create_group) | **POST** /groups | Create Group @@ -18,16 +19,19 @@ Method | HTTP request | Description [**delete_group_gallery**](GroupsApi.md#delete_group_gallery) | **DELETE** /groups/{groupId}/galleries/{groupGalleryId} | Delete Group Gallery [**delete_group_gallery_image**](GroupsApi.md#delete_group_gallery_image) | **DELETE** /groups/{groupId}/galleries/{groupGalleryId}/images/{groupGalleryImageId} | Delete Group Gallery Image [**delete_group_invite**](GroupsApi.md#delete_group_invite) | **DELETE** /groups/{groupId}/invites/{userId} | Delete User Invite +[**delete_group_post**](GroupsApi.md#delete_group_post) | **DELETE** /groups/{groupId}/posts/{notificationId} | Delete a Group post [**delete_group_role**](GroupsApi.md#delete_group_role) | **DELETE** /groups/{groupId}/roles/{groupRoleId} | Delete Group Role [**get_group**](GroupsApi.md#get_group) | **GET** /groups/{groupId} | Get Group by ID [**get_group_announcements**](GroupsApi.md#get_group_announcements) | **GET** /groups/{groupId}/announcement | Get Group Announcement [**get_group_audit_logs**](GroupsApi.md#get_group_audit_logs) | **GET** /groups/{groupId}/auditLogs | Get Group Audit Logs [**get_group_bans**](GroupsApi.md#get_group_bans) | **GET** /groups/{groupId}/bans | Get Group Bans [**get_group_gallery_images**](GroupsApi.md#get_group_gallery_images) | **GET** /groups/{groupId}/galleries/{groupGalleryId} | Get Group Gallery Images +[**get_group_instances**](GroupsApi.md#get_group_instances) | **GET** /groups/{groupId}/instances | Get Group Instances [**get_group_invites**](GroupsApi.md#get_group_invites) | **GET** /groups/{groupId}/invites | Get Group Invites Sent [**get_group_member**](GroupsApi.md#get_group_member) | **GET** /groups/{groupId}/members/{userId} | Get Group Member [**get_group_members**](GroupsApi.md#get_group_members) | **GET** /groups/{groupId}/members | List Group Members [**get_group_permissions**](GroupsApi.md#get_group_permissions) | **GET** /groups/{groupId}/permissions | List Group Permissions +[**get_group_post**](GroupsApi.md#get_group_post) | **GET** /groups/{groupId}/posts | Get posts from a Group [**get_group_requests**](GroupsApi.md#get_group_requests) | **GET** /groups/{groupId}/requests | Get Group Join Requests [**get_group_roles**](GroupsApi.md#get_group_roles) | **GET** /groups/{groupId}/roles | Get Group Roles [**join_group**](GroupsApi.md#join_group) | **POST** /groups/{groupId}/join | Join Group @@ -35,10 +39,12 @@ Method | HTTP request | Description [**leave_group**](GroupsApi.md#leave_group) | **POST** /groups/{groupId}/leave | Leave Group [**remove_group_member_role**](GroupsApi.md#remove_group_member_role) | **DELETE** /groups/{groupId}/members/{userId}/roles/{groupRoleId} | Remove Role from GroupMember [**respond_group_join_request**](GroupsApi.md#respond_group_join_request) | **PUT** /groups/{groupId}/requests/{userId} | Respond Group Join request +[**search_groups**](GroupsApi.md#search_groups) | **GET** /groups | Search Group [**unban_group_member**](GroupsApi.md#unban_group_member) | **DELETE** /groups/{groupId}/bans/{userId} | Unban Group Member [**update_group**](GroupsApi.md#update_group) | **PUT** /groups/{groupId} | Update Group [**update_group_gallery**](GroupsApi.md#update_group_gallery) | **PUT** /groups/{groupId}/galleries/{groupGalleryId} | Update Group Gallery [**update_group_member**](GroupsApi.md#update_group_member) | **PUT** /groups/{groupId}/members/{userId} | Update Group Member +[**update_group_post**](GroupsApi.md#update_group_post) | **PUT** /groups/{groupId}/posts/{notificationId} | Edits a Group post [**update_group_role**](GroupsApi.md#update_group_role) | **PUT** /groups/{groupId}/roles/{groupRoleId} | Update Group Role @@ -57,7 +63,7 @@ Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **group_id** | **String** | Must be a valid group ID. | [required] | **group_gallery_id** | **String** | Must be a valid group gallery ID. | [required] | -**add_group_gallery_image_request** | Option<[**AddGroupGalleryImageRequest**](AddGroupGalleryImageRequest.md)> | | | +**add_group_gallery_image_request** | [**AddGroupGalleryImageRequest**](AddGroupGalleryImageRequest.md) | | [required] | ### Return type @@ -107,6 +113,37 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## add_group_post + +> crate::models::GroupPost add_group_post(group_id, create_group_post_request) +Create a post in a Group + +Create a post in a Group. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**group_id** | **String** | Must be a valid group ID. | [required] | +**create_group_post_request** | [**CreateGroupPostRequest**](CreateGroupPostRequest.md) | | [required] | + +### Return type + +[**crate::models::GroupPost**](GroupPost.md) + +### Authorization + +[authCookie](../README.md#authCookie) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## ban_group_member > crate::models::GroupMember ban_group_member(group_id, ban_group_member_request) @@ -120,7 +157,7 @@ Bans a user from a Group. Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **group_id** | **String** | Must be a valid group ID. | [required] | -**ban_group_member_request** | Option<[**BanGroupMemberRequest**](BanGroupMemberRequest.md)> | | | +**ban_group_member_request** | [**BanGroupMemberRequest**](BanGroupMemberRequest.md) | | [required] | ### Return type @@ -180,7 +217,7 @@ Creates a Group and returns a Group object. **Requires VRC+ Subscription.** Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**create_group_request** | Option<[**CreateGroupRequest**](CreateGroupRequest.md)> | | | +**create_group_request** | [**CreateGroupRequest**](CreateGroupRequest.md) | | [required] | ### Return type @@ -211,7 +248,7 @@ Creates an Announcement for a Group. Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **group_id** | **String** | Must be a valid group ID. | [required] | -**create_group_announcement_request** | Option<[**CreateGroupAnnouncementRequest**](CreateGroupAnnouncementRequest.md)> | | | +**create_group_announcement_request** | [**CreateGroupAnnouncementRequest**](CreateGroupAnnouncementRequest.md) | | [required] | ### Return type @@ -242,7 +279,7 @@ Creates a gallery for a Group. Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **group_id** | **String** | Must be a valid group ID. | [required] | -**create_group_gallery_request** | Option<[**CreateGroupGalleryRequest**](CreateGroupGalleryRequest.md)> | | | +**create_group_gallery_request** | [**CreateGroupGalleryRequest**](CreateGroupGalleryRequest.md) | | [required] | ### Return type @@ -273,7 +310,7 @@ Sends an invite to a user to join the group. Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **group_id** | **String** | Must be a valid group ID. | [required] | -**create_group_invite_request** | Option<[**CreateGroupInviteRequest**](CreateGroupInviteRequest.md)> | | | +**create_group_invite_request** | [**CreateGroupInviteRequest**](CreateGroupInviteRequest.md) | | [required] | ### Return type @@ -304,7 +341,7 @@ Create a Group role. Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **group_id** | **String** | Must be a valid group ID. | [required] | -**create_group_role_request** | Option<[**CreateGroupRoleRequest**](CreateGroupRoleRequest.md)> | | | +**create_group_role_request** | [**CreateGroupRoleRequest**](CreateGroupRoleRequest.md) | | [required] | ### Return type @@ -476,6 +513,37 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## delete_group_post + +> crate::models::Success delete_group_post(group_id, notification_id) +Delete a Group post + +Delete a Group post + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**group_id** | **String** | Must be a valid group ID. | [required] | +**notification_id** | **String** | Must be a valid notification ID. | [required] | + +### Return type + +[**crate::models::Success**](Success.md) + +### Authorization + +[authCookie](../README.md#authCookie) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## delete_group_role > Vec delete_group_role(group_id, group_role_id) @@ -668,9 +736,39 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## get_group_instances + +> Vec get_group_instances(group_id) +Get Group Instances + +Returns a list of group instances + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**group_id** | **String** | Must be a valid group ID. | [required] | + +### Return type + +[**Vec**](GroupInstance.md) + +### Authorization + +[authCookie](../README.md#authCookie) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## get_group_invites -> Vec get_group_invites(group_id) +> Vec get_group_invites(group_id, n, offset) Get Group Invites Sent Returns a list of members that have been invited to the Group. @@ -681,6 +779,8 @@ Returns a list of members that have been invited to the Group. Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **group_id** | **String** | Must be a valid group ID. | [required] | +**n** | Option<**i32**> | The number of objects to return. | |[default to 60] +**offset** | Option<**i32**> | A zero-based offset from the default object sorting from where search results start. | | ### Return type @@ -731,7 +831,7 @@ Name | Type | Description | Required | Notes ## get_group_members -> Vec get_group_members(group_id, n, offset) +> Vec get_group_members(group_id, n, offset, sort) List Group Members Returns a List of all **other** Group Members. This endpoint will never return the user calling the endpoint. Information about the user calling the endpoint must be found in the `myMember` field of the Group object. @@ -744,6 +844,7 @@ Name | Type | Description | Required | Notes **group_id** | **String** | Must be a valid group ID. | [required] | **n** | Option<**i32**> | The number of objects to return. | |[default to 60] **offset** | Option<**i32**> | A zero-based offset from the default object sorting from where search results start. | | +**sort** | Option<[**GroupSearchSort**](.md)> | The sort order of Group Member results | | ### Return type @@ -791,9 +892,42 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## get_group_post + +> crate::models::GroupPost get_group_post(group_id, n, offset, public_only) +Get posts from a Group + +Get posts from a Group + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**group_id** | **String** | Must be a valid group ID. | [required] | +**n** | Option<**i32**> | The number of objects to return. | |[default to 60] +**offset** | Option<**i32**> | A zero-based offset from the default object sorting from where search results start. | | +**public_only** | Option<**bool**> | See public posts only. | | + +### Return type + +[**crate::models::GroupPost**](GroupPost.md) + +### Authorization + +[authCookie](../README.md#authCookie) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## get_group_requests -> Vec get_group_requests(group_id) +> Vec get_group_requests(group_id, n, offset, blocked) Get Group Join Requests Returns a list of members that have requested to join the Group. @@ -804,6 +938,9 @@ Returns a list of members that have requested to join the Group. Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **group_id** | **String** | Must be a valid group ID. | [required] | +**n** | Option<**i32**> | The number of objects to return. | |[default to 60] +**offset** | Option<**i32**> | A zero-based offset from the default object sorting from where search results start. | | +**blocked** | Option<**bool**> | See blocked join requests | | ### Return type @@ -988,7 +1125,7 @@ Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **group_id** | **String** | Must be a valid group ID. | [required] | **user_id** | **String** | Must be a valid user ID. | [required] | -**respond_group_join_request** | Option<[**RespondGroupJoinRequest**](RespondGroupJoinRequest.md)> | | | +**respond_group_join_request** | [**RespondGroupJoinRequest**](RespondGroupJoinRequest.md) | | [required] | ### Return type @@ -1006,6 +1143,38 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## search_groups + +> Vec search_groups(query, offset, n) +Search Group + +Searches Groups by name or shortCode + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**query** | Option<**String**> | Query to search for, can be either Group Name or Group shortCode | | +**offset** | Option<**i32**> | A zero-based offset from the default object sorting from where search results start. | | +**n** | Option<**i32**> | The number of objects to return. | |[default to 60] + +### Return type + +[**Vec**](LimitedGroup.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## unban_group_member > crate::models::GroupMember unban_group_member(group_id, user_id) @@ -1132,6 +1301,38 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## update_group_post + +> crate::models::GroupPost update_group_post(group_id, notification_id, create_group_post_request) +Edits a Group post + +Edits a Group post + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**group_id** | **String** | Must be a valid group ID. | [required] | +**notification_id** | **String** | Must be a valid notification ID. | [required] | +**create_group_post_request** | [**CreateGroupPostRequest**](CreateGroupPostRequest.md) | | [required] | + +### Return type + +[**crate::models::GroupPost**](GroupPost.md) + +### Authorization + +[authCookie](../README.md#authCookie) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## update_group_role > Vec update_group_role(group_id, group_role_id, update_group_role_request) diff --git a/docs/Instance.md b/docs/Instance.md index 7b9ae82..e56eebd 100644 --- a/docs/Instance.md +++ b/docs/Instance.md @@ -14,11 +14,11 @@ Name | Type | Description | Notes **location** | **String** | InstanceID can be \"offline\" on User profiles if you are not friends with that user and \"private\" if you are friends and user is in private instance. | **n_users** | **i32** | | **name** | **String** | | -**owner_id** | Option<**String**> | A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. | [optional] +**owner_id** | Option<**String**> | A groupId if the instance type is \"group\", null if instance type is public, or a userId otherwise | [optional] **permanent** | **bool** | | [default to false] **photon_region** | [**crate::models::Region**](Region.md) | | **platforms** | [**crate::models::InstancePlatforms**](InstancePlatforms.md) | | -**region** | [**crate::models::Region**](Region.md) | | +**region** | [**crate::models::InstanceRegion**](InstanceRegion.md) | | **secure_name** | **String** | | **short_name** | Option<**String**> | | [optional] **tags** | **Vec** | The tags array on Instances usually contain the language tags of the people in the instance. | @@ -27,6 +27,19 @@ Name | Type | Description | Notes **hidden** | Option<**String**> | A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. | [optional] **friends** | Option<**String**> | A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. | [optional] **private** | Option<**String**> | A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. | [optional] +**queue_enabled** | **bool** | | +**queue_size** | **i32** | | +**recommended_capacity** | **i32** | | +**role_restricted** | Option<**bool**> | | [optional] +**strict** | **bool** | | +**user_count** | **i32** | | +**world** | [**crate::models::World**](World.md) | | +**users** | Option<[**Vec**](LimitedUser.md)> | The users field is present on instances created by the requesting user. | [optional] +**group_access_type** | Option<[**crate::models::GroupAccessType**](GroupAccessType.md)> | | [optional] +**has_capacity_for_you** | Option<**bool**> | | [optional] +**nonce** | Option<**String**> | | [optional] +**closed_at** | Option<**String**> | | [optional] +**hard_close** | Option<**bool**> | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/InstanceRegion.md b/docs/InstanceRegion.md new file mode 100644 index 0000000..c49946e --- /dev/null +++ b/docs/InstanceRegion.md @@ -0,0 +1,10 @@ +# InstanceRegion + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/InstancesApi.md b/docs/InstancesApi.md index f6bbe5f..dba75aa 100644 --- a/docs/InstancesApi.md +++ b/docs/InstancesApi.md @@ -1,9 +1,11 @@ # \InstancesApi -All URIs are relative to *https://api.vrchat.cloud/api/1* +All URIs are relative to *https://vrchat.com/api/1* Method | HTTP request | Description ------------- | ------------- | ------------- +[**close_instance**](InstancesApi.md#close_instance) | **DELETE** /instances/{worldId}:{instanceId} | Close Instance +[**create_instance**](InstancesApi.md#create_instance) | **POST** /instances | Create Instance [**get_instance**](InstancesApi.md#get_instance) | **GET** /instances/{worldId}:{instanceId} | Get Instance [**get_instance_by_short_name**](InstancesApi.md#get_instance_by_short_name) | **GET** /instances/s/{shortName} | Get Instance By Short Name [**get_short_name**](InstancesApi.md#get_short_name) | **GET** /instances/{worldId}:{instanceId}/shortName | Get Instance Short Name @@ -11,6 +13,69 @@ Method | HTTP request | Description +## close_instance + +> crate::models::Instance close_instance(world_id, instance_id, hard_close, closed_at) +Close Instance + +Close an instance or update the closedAt time when it will be closed. You can only close an instance if the ownerId is yourself or if the instance owner is a group and you have the `group-instance-moderate` permission. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**world_id** | **String** | Must be a valid world ID. | [required] | +**instance_id** | **String** | Must be a valid instance ID. | [required] | +**hard_close** | Option<**bool**> | Whether to hard close the instance. Defaults to false. | | +**closed_at** | Option<**String**> | The time after which users won't be allowed to join the instances. If omitted, the instance will be closed immediately. | | + +### Return type + +[**crate::models::Instance**](Instance.md) + +### Authorization + +[authCookie](../README.md#authCookie) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## create_instance + +> crate::models::Instance create_instance(create_instance_request) +Create Instance + +Create an instance + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**create_instance_request** | [**CreateInstanceRequest**](CreateInstanceRequest.md) | | [required] | + +### Return type + +[**crate::models::Instance**](Instance.md) + +### Authorization + +[authCookie](../README.md#authCookie) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## get_instance > crate::models::Instance get_instance(world_id, instance_id) diff --git a/docs/InviteApi.md b/docs/InviteApi.md index 1169efd..35bce15 100644 --- a/docs/InviteApi.md +++ b/docs/InviteApi.md @@ -1,6 +1,6 @@ # \InviteApi -All URIs are relative to *https://api.vrchat.cloud/api/1* +All URIs are relative to *https://vrchat.com/api/1* Method | HTTP request | Description ------------- | ------------- | ------------- @@ -122,7 +122,7 @@ Sends an invite to a user. Returns the Notification of type `invite` that was se Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **user_id** | **String** | Must be a valid user ID. | [required] | -**invite_request** | Option<[**InviteRequest**](InviteRequest.md)> | Slot number of the Invite Message to use when inviting a user. | | +**invite_request** | [**InviteRequest**](InviteRequest.md) | Slot number of the Invite Message to use when inviting a user. | [required] | ### Return type @@ -216,7 +216,7 @@ Respond to an invite request by sending a world invite to the requesting user. ` Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **notification_id** | **String** | Must be a valid notification ID. | [required] | -**invite_response** | Option<[**InviteResponse**](InviteResponse.md)> | Slot number of the Response Message to use when responding to a user. | | +**invite_response** | [**InviteResponse**](InviteResponse.md) | Slot number of the Response Message to use when responding to a user. | [required] | ### Return type diff --git a/docs/LimitedGroup.md b/docs/LimitedGroup.md new file mode 100644 index 0000000..c68e362 --- /dev/null +++ b/docs/LimitedGroup.md @@ -0,0 +1,27 @@ +# LimitedGroup + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | Option<**String**> | | [optional] +**name** | Option<**String**> | | [optional] +**short_code** | Option<**String**> | | [optional] +**discriminator** | Option<**String**> | | [optional] +**description** | Option<**String**> | | [optional] +**icon_url** | Option<**String**> | | [optional] +**banner_url** | Option<**String**> | | [optional] +**owner_id** | Option<**String**> | A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. | [optional] +**rules** | Option<**String**> | | [optional] +**icon_id** | Option<**String**> | | [optional] +**banner_id** | Option<**String**> | | [optional] +**member_count** | Option<**i32**> | | [optional] +**tags** | Option<**Vec**> | | [optional] +**created_at** | Option<**String**> | | [optional] +**membership_status** | Option<[**crate::models::GroupMemberStatus**](GroupMemberStatus.md)> | | [optional] +**is_searchable** | Option<**bool**> | | [optional] +**galleries** | Option<[**Vec**](GroupGallery.md)> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/LimitedUser.md b/docs/LimitedUser.md index 0d68c2d..41de062 100644 --- a/docs/LimitedUser.md +++ b/docs/LimitedUser.md @@ -5,19 +5,22 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **bio** | Option<**String**> | | [optional] -**current_avatar_image_url** | **String** | When profilePicOverride is not empty, use it instead. | -**current_avatar_thumbnail_image_url** | **String** | When profilePicOverride is not empty, use it instead. | +**bio_links** | Option<**Vec**> | | [optional] +**current_avatar_image_url** | Option<**String**> | When profilePicOverride is not empty, use it instead. | [optional] +**current_avatar_thumbnail_image_url** | Option<**String**> | When profilePicOverride is not empty, use it instead. | [optional] +**current_avatar_tags** | Option<**Vec**> | | [optional] **developer_type** | [**crate::models::DeveloperType**](DeveloperType.md) | | **display_name** | **String** | | **fallback_avatar** | Option<**String**> | | [optional] **id** | **String** | A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. | **is_friend** | **bool** | | **last_platform** | **String** | This can be `standalonewindows` or `android`, but can also pretty much be any random Unity verison such as `2019.2.4-801-Release` or `2019.2.2-772-Release` or even `unknownplatform`. | -**profile_pic_override** | **String** | | +**profile_pic_override** | Option<**String**> | | [optional] +**pronouns** | Option<**String**> | | [optional] **status** | [**crate::models::UserStatus**](UserStatus.md) | | **status_description** | **String** | | **tags** | **Vec** | <- Always empty. | -**user_icon** | **String** | | +**user_icon** | Option<**String**> | | [optional] **username** | Option<**String**> | -| **DEPRECATED:** VRChat API no longer return usernames of other users. [See issue by Tupper for more information](https://github.com/pypy-vrc/VRCX/issues/429). | [optional] **location** | Option<**String**> | | [optional] **friend_key** | Option<**String**> | | [optional] diff --git a/docs/LimitedUserGroups.md b/docs/LimitedUserGroups.md new file mode 100644 index 0000000..488e010 --- /dev/null +++ b/docs/LimitedUserGroups.md @@ -0,0 +1,28 @@ +# LimitedUserGroups + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | Option<**String**> | | [optional] +**name** | Option<**String**> | | [optional] +**short_code** | Option<**String**> | | [optional] +**discriminator** | Option<**String**> | | [optional] +**description** | Option<**String**> | | [optional] +**icon_id** | Option<**String**> | | [optional] +**icon_url** | Option<**String**> | | [optional] +**banner_id** | Option<**String**> | | [optional] +**banner_url** | Option<**String**> | | [optional] +**privacy** | Option<**String**> | | [optional] +**last_post_created_at** | Option<**String**> | | [optional] +**owner_id** | Option<**String**> | A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. | [optional] +**member_count** | Option<**i32**> | | [optional] +**group_id** | Option<**String**> | | [optional] +**member_visibility** | Option<**String**> | | [optional] +**is_representing** | Option<**bool**> | | [optional] +**mutual_group** | Option<**bool**> | | [optional] +**last_post_read_at** | Option<**String**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/LimitedWorld.md b/docs/LimitedWorld.md index 8de9e3e..0fbea58 100644 --- a/docs/LimitedWorld.md +++ b/docs/LimitedWorld.md @@ -7,8 +7,10 @@ Name | Type | Description | Notes **author_id** | **String** | A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. | **author_name** | **String** | | **capacity** | **i32** | | +**recommended_capacity** | Option<**i32**> | | [optional] **created_at** | **String** | | **favorites** | **i32** | | [default to 0] +**visits** | Option<**i32**> | | [optional][default to 0] **heat** | **i32** | | [default to 0] **id** | **String** | WorldID be \"offline\" on User profiles if you are not friends with that user. | **image_url** | **String** | | @@ -17,12 +19,14 @@ Name | Type | Description | Notes **occupants** | **i32** | | [default to 0] **organization** | **String** | | [default to vrchat] **popularity** | **i32** | | [default to 0] +**preview_youtube_id** | Option<**String**> | | [optional] **publication_date** | **String** | | **release_status** | [**crate::models::ReleaseStatus**](ReleaseStatus.md) | | **tags** | **Vec** | | **thumbnail_image_url** | **String** | | **unity_packages** | [**Vec**](LimitedUnityPackage.md) | | **updated_at** | **String** | | +**udon_products** | Option<**Vec**> | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/NotificationDetailInvite.md b/docs/NotificationDetailInvite.md new file mode 100644 index 0000000..9da07b3 --- /dev/null +++ b/docs/NotificationDetailInvite.md @@ -0,0 +1,13 @@ +# NotificationDetailInvite + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**invite_message** | Option<**String**> | | [optional] +**world_id** | **String** | WorldID be \"offline\" on User profiles if you are not friends with that user. | +**world_name** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/NotificationDetailInviteResponse.md b/docs/NotificationDetailInviteResponse.md new file mode 100644 index 0000000..8be49a3 --- /dev/null +++ b/docs/NotificationDetailInviteResponse.md @@ -0,0 +1,12 @@ +# NotificationDetailInviteResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**in_response_to** | **String** | | +**response_message** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/NotificationDetailRequestInvite.md b/docs/NotificationDetailRequestInvite.md new file mode 100644 index 0000000..41a2bde --- /dev/null +++ b/docs/NotificationDetailRequestInvite.md @@ -0,0 +1,12 @@ +# NotificationDetailRequestInvite + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**platform** | Option<**String**> | TODO: Does this still exist? | [optional] +**request_message** | Option<**String**> | Used when using InviteMessage Slot. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/NotificationDetailRequestInviteResponse.md b/docs/NotificationDetailRequestInviteResponse.md new file mode 100644 index 0000000..ed5086b --- /dev/null +++ b/docs/NotificationDetailRequestInviteResponse.md @@ -0,0 +1,12 @@ +# NotificationDetailRequestInviteResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**in_response_to** | **String** | | +**request_message** | Option<**String**> | Used when using InviteMessage Slot. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/NotificationDetailVoteToKick.md b/docs/NotificationDetailVoteToKick.md new file mode 100644 index 0000000..8177d89 --- /dev/null +++ b/docs/NotificationDetailVoteToKick.md @@ -0,0 +1,12 @@ +# NotificationDetailVoteToKick + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**initiator_user_id** | **String** | A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. | +**user_to_kick_id** | **String** | A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/NotificationsApi.md b/docs/NotificationsApi.md index 541374b..2c08cb3 100644 --- a/docs/NotificationsApi.md +++ b/docs/NotificationsApi.md @@ -1,6 +1,6 @@ # \NotificationsApi -All URIs are relative to *https://api.vrchat.cloud/api/1* +All URIs are relative to *https://vrchat.com/api/1* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/docs/PermissionsApi.md b/docs/PermissionsApi.md index bd2aae6..409b656 100644 --- a/docs/PermissionsApi.md +++ b/docs/PermissionsApi.md @@ -1,6 +1,6 @@ # \PermissionsApi -All URIs are relative to *https://api.vrchat.cloud/api/1* +All URIs are relative to *https://vrchat.com/api/1* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/docs/PlayermoderationApi.md b/docs/PlayermoderationApi.md index 077f8d1..5e14892 100644 --- a/docs/PlayermoderationApi.md +++ b/docs/PlayermoderationApi.md @@ -1,6 +1,6 @@ # \PlayermoderationApi -All URIs are relative to *https://api.vrchat.cloud/api/1* +All URIs are relative to *https://vrchat.com/api/1* Method | HTTP request | Description ------------- | ------------- | ------------- @@ -143,7 +143,7 @@ Moderate a user, e.g. unmute them or show their avatar. Please see the [Player Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**moderate_user_request** | Option<[**ModerateUserRequest**](ModerateUserRequest.md)> | | | +**moderate_user_request** | [**ModerateUserRequest**](ModerateUserRequest.md) | | [required] | ### Return type @@ -173,7 +173,7 @@ Removes a player moderation previously added through `moderateUser`. E.g if you Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- -**moderate_user_request** | Option<[**ModerateUserRequest**](ModerateUserRequest.md)> | | | +**moderate_user_request** | [**ModerateUserRequest**](ModerateUserRequest.md) | | [required] | ### Return type diff --git a/docs/RepresentedGroup.md b/docs/RepresentedGroup.md new file mode 100644 index 0000000..2b9aa3f --- /dev/null +++ b/docs/RepresentedGroup.md @@ -0,0 +1,24 @@ +# RepresentedGroup + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | Option<**String**> | | [optional] +**short_code** | Option<**String**> | | [optional] +**discriminator** | Option<**String**> | | [optional] +**description** | Option<**String**> | | [optional] +**icon_id** | Option<**String**> | | [optional] +**icon_url** | Option<**String**> | | [optional] +**banner_id** | Option<**String**> | | [optional] +**banner_url** | Option<**String**> | | [optional] +**privacy** | Option<[**crate::models::GroupPrivacy**](GroupPrivacy.md)> | | [optional] +**owner_id** | Option<**String**> | A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. | [optional] +**member_count** | Option<**i32**> | | [optional] +**group_id** | Option<**String**> | | [optional] +**member_visibility** | Option<[**crate::models::GroupUserVisibility**](GroupUserVisibility.md)> | | [optional] +**is_representing** | Option<**bool**> | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/RespondGroupJoinRequest.md b/docs/RespondGroupJoinRequest.md index 972cd02..a8cce60 100644 --- a/docs/RespondGroupJoinRequest.md +++ b/docs/RespondGroupJoinRequest.md @@ -4,7 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**action** | Option<**String**> | | [optional] +**action** | [**crate::models::GroupJoinRequestAction**](GroupJoinRequestAction.md) | | +**block** | Option<**bool**> | Whether to block the user from requesting again | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/SentNotification.md b/docs/SentNotification.md index 1a8d02e..e0d74c1 100644 --- a/docs/SentNotification.md +++ b/docs/SentNotification.md @@ -5,10 +5,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **created_at** | **String** | | -**details** | **String** | **NOTICE:** This is not a JSON object, this is a json **encoded** object, meaning you have to json-de-encode to get the NotificationDetail object depending on the NotificationType. | [default to {}] +**details** | [**serde_json::Value**](.md) | | **id** | **String** | | **message** | **String** | | -**reciever_user_id** | **String** | A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. | +**receiver_user_id** | **String** | A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. | **sender_user_id** | **String** | A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. | **sender_username** | Option<**String**> | -| **DEPRECATED:** VRChat API no longer return usernames of other users. [See issue by Tupper for more information](https://github.com/pypy-vrc/VRCX/issues/429). | [optional] **r#type** | [**crate::models::NotificationType**](NotificationType.md) | | diff --git a/docs/Subscription.md b/docs/Subscription.md index bca85e6..fd0aa10 100644 --- a/docs/Subscription.md +++ b/docs/Subscription.md @@ -6,6 +6,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **String** | | **steam_item_id** | **String** | | +**oculus_sku** | Option<**String**> | | [optional] +**google_product_id** | Option<**String**> | | [optional] +**google_plan_id** | Option<**String**> | | [optional] +**pico_sku** | Option<**String**> | | [optional] **amount** | **f32** | | **description** | **String** | | **period** | [**crate::models::SubscriptionPeriod**](SubscriptionPeriod.md) | | diff --git a/docs/SystemApi.md b/docs/SystemApi.md index 3a25824..d1c0cee 100644 --- a/docs/SystemApi.md +++ b/docs/SystemApi.md @@ -1,6 +1,6 @@ # \SystemApi -All URIs are relative to *https://api.vrchat.cloud/api/1* +All URIs are relative to *https://vrchat.com/api/1* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/docs/Transaction.md b/docs/Transaction.md index d808dd1..c1f7e01 100644 --- a/docs/Transaction.md +++ b/docs/Transaction.md @@ -5,6 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **String** | | +**user_id** | Option<**String**> | A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. | [optional] +**user_display_name** | Option<**String**> | | [optional] **status** | [**crate::models::TransactionStatus**](TransactionStatus.md) | | **subscription** | [**crate::models::Subscription**](Subscription.md) | | **sandbox** | **bool** | | [default to false] @@ -13,6 +15,8 @@ Name | Type | Description | Notes **steam** | Option<[**crate::models::TransactionSteamInfo**](TransactionSteamInfo.md)> | | [optional] **agreement** | Option<[**crate::models::TransactionAgreement**](TransactionAgreement.md)> | | [optional] **error** | **String** | | +**is_gift** | Option<**bool**> | | [optional][default to false] +**is_tokens** | Option<**bool**> | | [optional][default to false] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/UnityPackage.md b/docs/UnityPackage.md index f5e4e39..0878989 100644 --- a/docs/UnityPackage.md +++ b/docs/UnityPackage.md @@ -4,16 +4,19 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**id** | **String** | | **asset_url** | Option<**String**> | | [optional] **asset_url_object** | Option<[**serde_json::Value**](.md)> | | [optional] **asset_version** | **i32** | | **created_at** | Option<**String**> | | [optional] -**id** | **String** | | **platform** | **String** | This can be `standalonewindows` or `android`, but can also pretty much be any random Unity verison such as `2019.2.4-801-Release` or `2019.2.2-772-Release` or even `unknownplatform`. | **plugin_url** | Option<**String**> | | [optional] **plugin_url_object** | Option<[**serde_json::Value**](.md)> | | [optional] **unity_sort_number** | Option<**i64**> | | [optional] **unity_version** | **String** | | [default to 5.3.4p1] +**impostor_url** | Option<**String**> | | [optional] +**scan_status** | Option<**String**> | | [optional] +**variant** | Option<**String**> | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/UpdateAvatarRequest.md b/docs/UpdateAvatarRequest.md index 570ad6f..f4466c9 100644 --- a/docs/UpdateAvatarRequest.md +++ b/docs/UpdateAvatarRequest.md @@ -13,6 +13,7 @@ Name | Type | Description | Notes **release_status** | Option<[**crate::models::ReleaseStatus**](ReleaseStatus.md)> | | [optional] **version** | Option<**f32**> | | [optional][default to 1] **unity_package_url** | Option<**String**> | | [optional] +**unity_version** | Option<**String**> | | [optional][default to 5.3.4p1] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/UpdateUserRequest.md b/docs/UpdateUserRequest.md index 1c0e877..0e861e0 100644 --- a/docs/UpdateUserRequest.md +++ b/docs/UpdateUserRequest.md @@ -12,6 +12,7 @@ Name | Type | Description | Notes **status_description** | Option<**String**> | | [optional] **bio** | Option<**String**> | | [optional] **bio_links** | Option<**Vec**> | | [optional] +**pronouns** | Option<**String**> | | [optional] **user_icon** | Option<**String**> | MUST be a valid VRChat /file/ url. | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/User.md b/docs/User.md index 637406b..6403f7c 100644 --- a/docs/User.md +++ b/docs/User.md @@ -5,10 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **allow_avatar_copying** | **bool** | | [default to true] +**badges** | Option<[**Vec**](Badge.md)> | | [optional] **bio** | **String** | | **bio_links** | **Vec** | | **current_avatar_image_url** | **String** | When profilePicOverride is not empty, use it instead. | **current_avatar_thumbnail_image_url** | **String** | When profilePicOverride is not empty, use it instead. | +**current_avatar_tags** | **Vec** | | **date_joined** | [**String**](string.md) | | **developer_type** | [**crate::models::DeveloperType**](DeveloperType.md) | | **display_name** | **String** | A users visual display name. This is what shows up in-game, and can different from their `username`. Changing display name is restricted to a cooldown period. | @@ -23,6 +25,7 @@ Name | Type | Description | Notes **location** | Option<**String**> | WorldID be \"offline\" on User profiles if you are not friends with that user. | [optional] **note** | Option<**String**> | | [optional] **profile_pic_override** | **String** | | +**pronouns** | **String** | | **state** | [**crate::models::UserState**](UserState.md) | | **status** | [**crate::models::UserStatus**](UserStatus.md) | | **status_description** | **String** | | diff --git a/docs/UsersApi.md b/docs/UsersApi.md index 65063ef..1b77c4c 100644 --- a/docs/UsersApi.md +++ b/docs/UsersApi.md @@ -1,6 +1,6 @@ # \UsersApi -All URIs are relative to *https://api.vrchat.cloud/api/1* +All URIs are relative to *https://vrchat.com/api/1* Method | HTTP request | Description ------------- | ------------- | ------------- @@ -8,6 +8,7 @@ Method | HTTP request | Description [**get_user_by_name**](UsersApi.md#get_user_by_name) | **GET** /users/{username}/name | Get User by Username [**get_user_group_requests**](UsersApi.md#get_user_group_requests) | **GET** /users/{userId}/groups/requested | Get User Group Requests [**get_user_groups**](UsersApi.md#get_user_groups) | **GET** /users/{userId}/groups | Get User Groups +[**get_user_represented_group**](UsersApi.md#get_user_represented_group) | **GET** /users/{userId}/groups/represented | Get user's current represented group [**search_users**](UsersApi.md#search_users) | **GET** /users | Search All Users [**update_user**](UsersApi.md#update_user) | **PUT** /users/{userId} | Update User Info @@ -105,7 +106,7 @@ Name | Type | Description | Required | Notes ## get_user_groups -> Vec get_user_groups(user_id) +> Vec get_user_groups(user_id) Get User Groups Get user's public groups @@ -119,7 +120,37 @@ Name | Type | Description | Required | Notes ### Return type -[**Vec**](Group.md) +[**Vec**](LimitedUserGroups.md) + +### Authorization + +[authCookie](../README.md#authCookie) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +## get_user_represented_group + +> crate::models::RepresentedGroup get_user_represented_group(user_id) +Get user's current represented group + +Returns the current group that the user is currently representing + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**user_id** | **String** | Must be a valid user ID. | [required] | + +### Return type + +[**crate::models::RepresentedGroup**](representedGroup.md) ### Authorization diff --git a/docs/World.md b/docs/World.md index 40fb387..c76c526 100644 --- a/docs/World.md +++ b/docs/World.md @@ -18,7 +18,7 @@ Name | Type | Description | Notes **instances** | Option<[**Vec>**](array.md)> | Will always be an empty list when unauthenticated. | [optional] **labs_publication_date** | **String** | | **name** | **String** | | -**namespace** | **String** | | +**namespace** | Option<**String**> | | [optional] **occupants** | Option<**i32**> | Will always be `0` when unauthenticated. | [optional][default to 0] **organization** | **String** | | [default to vrchat] **popularity** | **i32** | | [default to 0] @@ -33,6 +33,7 @@ Name | Type | Description | Notes **updated_at** | **String** | | **version** | **i32** | | [default to 0] **visits** | **i32** | | [default to 0] +**udon_products** | Option<**Vec**> | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/WorldPublishStatus.md b/docs/WorldPublishStatus.md index d10aa18..4afdcb6 100644 --- a/docs/WorldPublishStatus.md +++ b/docs/WorldPublishStatus.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**can_pubilsh** | **bool** | | [default to true] +**can_publish** | **bool** | | [default to true] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/WorldsApi.md b/docs/WorldsApi.md index 64b42f5..67ef9e3 100644 --- a/docs/WorldsApi.md +++ b/docs/WorldsApi.md @@ -1,6 +1,6 @@ # \WorldsApi -All URIs are relative to *https://api.vrchat.cloud/api/1* +All URIs are relative to *https://vrchat.com/api/1* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/src/apis/authentication_api.rs b/src/apis/authentication_api.rs index 54e5274..47dba7f 100644 --- a/src/apis/authentication_api.rs +++ b/src/apis/authentication_api.rs @@ -9,7 +9,7 @@ use reqwest; -use crate::apis::ResponseContent; +#[allow(unused_imports)] use crate::apis::ResponseContent; use super::{Error, configuration}; @@ -79,13 +79,9 @@ pub enum VerifyRecoveryCodeError { /// Checks if a user by a given `username`, `displayName` or `email` exist. This is used during registration to check if a username has already been taken, during change of displayName to check if a displayName is available, and during change of email to check if the email is already used. In the later two cases the `excludeUserId` is used to exclude oneself, otherwise the result would always be true. It is **REQUIRED** to include **AT LEAST** `username`, `displayName` **or** `email` query parameter. Although they can be combined - in addition with `excludeUserId` (generally to exclude yourself) - to further fine-tune the search. -pub fn check_user_exists(configuration: &configuration::Configuration, email: Option<&str>, display_name: Option<&str>, user_id: Option<&str>, exclude_user_id: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/auth/exists", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); +pub async fn check_user_exists(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, email: Option<&str>, display_name: Option<&str>, user_id: Option<&str>, exclude_user_id: Option<&str>) -> Result> { + let local_var_uri_str = format!("{}/auth/exists", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = email { local_var_req_builder = local_var_req_builder.query(&[("email", &local_var_str.to_string())]); @@ -99,224 +95,58 @@ pub fn check_user_exists(configuration: &configuration::Configuration, email: Op if let Some(ref local_var_str) = exclude_user_id { local_var_req_builder = local_var_req_builder.query(&[("excludeUserId", &local_var_str.to_string())]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Deletes the account with given ID. Normal users only have permission to delete their own account. Account deletion is 14 days from this request, and will be cancelled if you do an authenticated request with the account afterwards. **VRC+ NOTE:** Despite the 14-days cooldown, any VRC+ subscription will be cancelled **immediately**. **METHOD NOTE:** Despite this being a Delete action, the method type required is PUT. -pub fn delete_user(configuration: &configuration::Configuration, user_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/users/{userId}/delete", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn delete_user(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, user_id: &str) -> Result> { + let local_var_uri_str = format!("{}/users/{userId}/delete", configuration.base_path, userId=crate::apis::urlencode(user_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// This endpoint does the following two operations: 1) Checks if you are already logged in by looking for a valid `auth` cookie. If you are have a valid auth cookie then no additional auth-related actions are taken. If you are **not** logged in then it will log you in with the `Authorization` header and set the `auth` cookie. The `auth` cookie will only be sent once. 2) If logged in, this function will also return the CurrentUser object containing detailed information about the currently logged in user. The auth string after `Authorization: Basic {string}` is a base64-encoded string of the username and password, both individually url-encoded, and then joined with a colon. > base64(urlencode(username):urlencode(password)) **WARNING: Session Limit:** Each authentication with login credentials counts as a separate session, out of which you have a limited amount. Make sure to save and reuse the `auth` cookie if you are often restarting the program. The provided API libraries automatically save cookies during runtime, but does not persist during restart. While it can be fine to use username/password during development, expect in production to very fast run into the rate-limit and be temporarily blocked from making new sessions until older ones expire. The exact number of simultaneous sessions is unknown/undisclosed. -pub fn get_current_user(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/auth/user", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { +pub async fn get_current_user(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, ) -> Result> { + let local_var_uri_str = format!("{}/auth/user", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + if let Some(ref local_var_auth_conf) = configuration.basic_auth { local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); }; - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Invalidates the login session. -pub fn logout(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/logout", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn logout(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, ) -> Result> { + let local_var_uri_str = format!("{}/logout", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Finishes the login sequence with a normal 2FA-generated code for accounts with 2FA-protection enabled. -pub fn verify2_fa(configuration: &configuration::Configuration, two_factor_auth_code: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/auth/twofactorauth/totp/verify", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(&two_factor_auth_code); - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn verify2_fa(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, two_factor_auth_code: crate::models::TwoFactorAuthCode) -> Result> { + let local_var_uri_str = format!("{}/auth/twofactorauth/totp/verify", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, Some(two_factor_auth_code)).await } /// Finishes the login sequence with an 2FA email code. -pub fn verify2_fa_email_code(configuration: &configuration::Configuration, two_factor_email_code: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/auth/twofactorauth/emailotp/verify", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(&two_factor_email_code); - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn verify2_fa_email_code(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, two_factor_email_code: crate::models::TwoFactorEmailCode) -> Result> { + let local_var_uri_str = format!("{}/auth/twofactorauth/emailotp/verify", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, Some(two_factor_email_code)).await } /// Verify whether the currently provided Auth Token is valid. -pub fn verify_auth_token(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/auth", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn verify_auth_token(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, ) -> Result> { + let local_var_uri_str = format!("{}/auth", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Finishes the login sequence with an OTP (One Time Password) recovery code for accounts with 2FA-protection enabled. -pub fn verify_recovery_code(configuration: &configuration::Configuration, two_factor_auth_code: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/auth/twofactorauth/otp/verify", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(&two_factor_auth_code); - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn verify_recovery_code(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, two_factor_auth_code: crate::models::TwoFactorAuthCode) -> Result> { + let local_var_uri_str = format!("{}/auth/twofactorauth/otp/verify", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, Some(two_factor_auth_code)).await } diff --git a/src/apis/avatars_api.rs b/src/apis/avatars_api.rs index af55607..cf3cb89 100644 --- a/src/apis/avatars_api.rs +++ b/src/apis/avatars_api.rs @@ -9,7 +9,7 @@ use reqwest; -use crate::apis::ResponseContent; +#[allow(unused_imports)] use crate::apis::ResponseContent; use super::{Error, configuration}; @@ -95,98 +95,30 @@ pub enum UpdateAvatarError { /// Create an avatar. It's possible to optionally specify a ID if you want a custom one. Attempting to create an Avatar with an already claimed ID will result in a DB error. -pub fn create_avatar(configuration: &configuration::Configuration, create_avatar_request: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/avatars", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(&create_avatar_request); - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn create_avatar(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, create_avatar_request: Option) -> Result> { + let local_var_uri_str = format!("{}/avatars", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, Some(create_avatar_request)).await } /// Delete an avatar. Notice an avatar is never fully \"deleted\", only its ReleaseStatus is set to \"hidden\" and the linked Files are deleted. The AvatarID is permanently reserved. -pub fn delete_avatar(configuration: &configuration::Configuration, avatar_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/avatars/{avatarId}", local_var_configuration.base_path, avatarId=crate::apis::urlencode(avatar_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn delete_avatar(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, avatar_id: &str) -> Result> { + let local_var_uri_str = format!("{}/avatars/{avatarId}", configuration.base_path, avatarId=crate::apis::urlencode(avatar_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Get information about a specific Avatar. -pub fn get_avatar(configuration: &configuration::Configuration, avatar_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/avatars/{avatarId}", local_var_configuration.base_path, avatarId=crate::apis::urlencode(avatar_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_avatar(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, avatar_id: &str) -> Result> { + let local_var_uri_str = format!("{}/avatars/{avatarId}", configuration.base_path, avatarId=crate::apis::urlencode(avatar_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Search and list favorited avatars by query filters. -pub fn get_favorited_avatars(configuration: &configuration::Configuration, featured: Option, sort: Option, n: Option, order: Option, offset: Option, search: Option<&str>, tag: Option<&str>, notag: Option<&str>, release_status: Option, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>, user_id: Option<&str>) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/avatars/favorites", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); +pub async fn get_favorited_avatars(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, featured: Option, sort: Option, n: Option, order: Option, offset: Option, search: Option<&str>, tag: Option<&str>, notag: Option<&str>, release_status: Option, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>, user_id: Option<&str>) -> Result, Error> { + let local_var_uri_str = format!("{}/avatars/favorites", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = featured { local_var_req_builder = local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); @@ -227,61 +159,20 @@ pub fn get_favorited_avatars(configuration: &configuration::Configuration, featu if let Some(ref local_var_str) = user_id { local_var_req_builder = local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Get the current avatar for the user. This will return an error for any other user than the one logged in. -pub fn get_own_avatar(configuration: &configuration::Configuration, user_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/users/{userId}/avatar", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_own_avatar(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, user_id: &str) -> Result> { + let local_var_uri_str = format!("{}/users/{userId}/avatar", configuration.base_path, userId=crate::apis::urlencode(user_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Search and list avatars by query filters. You can only search your own or featured avatars. It is not possible as a normal user to search other peoples avatars. -pub fn search_avatars(configuration: &configuration::Configuration, featured: Option, sort: Option, user: Option<&str>, user_id: Option<&str>, n: Option, order: Option, offset: Option, tag: Option<&str>, notag: Option<&str>, release_status: Option, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/avatars", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); +pub async fn search_avatars(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, featured: Option, sort: Option, user: Option<&str>, user_id: Option<&str>, n: Option, order: Option, offset: Option, tag: Option<&str>, notag: Option<&str>, release_status: Option, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>) -> Result, Error> { + let local_var_uri_str = format!("{}/avatars", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = featured { local_var_req_builder = local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); @@ -322,107 +213,27 @@ pub fn search_avatars(configuration: &configuration::Configuration, featured: Op if let Some(ref local_var_str) = platform { local_var_req_builder = local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Switches into that avatar. -pub fn select_avatar(configuration: &configuration::Configuration, avatar_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/avatars/{avatarId}/select", local_var_configuration.base_path, avatarId=crate::apis::urlencode(avatar_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn select_avatar(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, avatar_id: &str) -> Result> { + let local_var_uri_str = format!("{}/avatars/{avatarId}/select", configuration.base_path, avatarId=crate::apis::urlencode(avatar_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Switches into that avatar as your fallback avatar. -pub fn select_fallback_avatar(configuration: &configuration::Configuration, avatar_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/avatars/{avatarId}/selectFallback", local_var_configuration.base_path, avatarId=crate::apis::urlencode(avatar_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn select_fallback_avatar(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, avatar_id: &str) -> Result> { + let local_var_uri_str = format!("{}/avatars/{avatarId}/selectFallback", configuration.base_path, avatarId=crate::apis::urlencode(avatar_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Update information about a specific avatar. -pub fn update_avatar(configuration: &configuration::Configuration, avatar_id: &str, update_avatar_request: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/avatars/{avatarId}", local_var_configuration.base_path, avatarId=crate::apis::urlencode(avatar_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(&update_avatar_request); - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn update_avatar(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, avatar_id: &str, update_avatar_request: Option) -> Result> { + let local_var_uri_str = format!("{}/avatars/{avatarId}", configuration.base_path, avatarId=crate::apis::urlencode(avatar_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, Some(update_avatar_request)).await } diff --git a/src/apis/configuration.rs b/src/apis/configuration.rs index 2b373c8..27bab60 100644 --- a/src/apis/configuration.rs +++ b/src/apis/configuration.rs @@ -11,10 +11,10 @@ use reqwest; #[derive(Debug, Clone)] -pub struct Configuration { +pub struct Configuration { pub base_path: String, pub user_agent: Option, - pub client: reqwest::Client, + pub client: T, pub basic_auth: Option, pub oauth_access_token: Option, pub bearer_access_token: Option, @@ -31,18 +31,18 @@ pub struct ApiKey { } -impl Configuration { - pub fn new() -> Configuration { +impl Configuration { + pub fn new() -> Configuration> { Configuration::default() } } -impl Default for Configuration { +impl Default for Configuration> { fn default() -> Self { Configuration { - base_path: "https://api.vrchat.cloud/api/1".to_owned(), + base_path: "https://vrchat.com/api/1".to_owned(), user_agent: Some("vrchatapi-rust".to_owned()), - client: reqwest::Client::builder().cookie_store(true).build().unwrap(), + client: std::sync::Arc::new(reqwest::Client::builder().cookie_store(true).build().unwrap()), basic_auth: None, oauth_access_token: None, bearer_access_token: None, diff --git a/src/apis/economy_api.rs b/src/apis/economy_api.rs index ae36446..0efd3f5 100644 --- a/src/apis/economy_api.rs +++ b/src/apis/economy_api.rs @@ -9,7 +9,7 @@ use reqwest; -use crate::apis::ResponseContent; +#[allow(unused_imports)] use crate::apis::ResponseContent; use super::{Error, configuration}; @@ -55,142 +55,37 @@ pub enum GetSubscriptionsError { /// Get a list of all current user subscriptions. -pub fn get_current_subscriptions(configuration: &configuration::Configuration, ) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/auth/user/subscription", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_current_subscriptions(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, ) -> Result, Error> { + let local_var_uri_str = format!("{}/auth/user/subscription", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Get a single License Group by given ID. -pub fn get_license_group(configuration: &configuration::Configuration, license_group_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/licenseGroups/{licenseGroupId}", local_var_configuration.base_path, licenseGroupId=crate::apis::urlencode(license_group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_license_group(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, license_group_id: &str) -> Result> { + let local_var_uri_str = format!("{}/licenseGroups/{licenseGroupId}", configuration.base_path, licenseGroupId=crate::apis::urlencode(license_group_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Get a single Steam transactions by ID. This returns the exact same information as `getSteamTransactions`, so no point in using this endpoint. -pub fn get_steam_transaction(configuration: &configuration::Configuration, transaction_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/Steam/transactions/{transactionId}", local_var_configuration.base_path, transactionId=crate::apis::urlencode(transaction_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_steam_transaction(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, transaction_id: &str) -> Result> { + let local_var_uri_str = format!("{}/Steam/transactions/{transactionId}", configuration.base_path, transactionId=crate::apis::urlencode(transaction_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Get all own Steam transactions. -pub fn get_steam_transactions(configuration: &configuration::Configuration, ) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/Steam/transactions", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_steam_transactions(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, ) -> Result, Error> { + let local_var_uri_str = format!("{}/Steam/transactions", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// List all existing Subscriptions. For example, \"vrchatplus-monthly\" and \"vrchatplus-yearly\". -pub fn get_subscriptions(configuration: &configuration::Configuration, ) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/subscriptions", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_subscriptions(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, ) -> Result, Error> { + let local_var_uri_str = format!("{}/subscriptions", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } diff --git a/src/apis/favorites_api.rs b/src/apis/favorites_api.rs index 6405154..5bf079f 100644 --- a/src/apis/favorites_api.rs +++ b/src/apis/favorites_api.rs @@ -9,7 +9,7 @@ use reqwest; -use crate::apis::ResponseContent; +#[allow(unused_imports)] use crate::apis::ResponseContent; use super::{Error, configuration}; @@ -79,126 +79,37 @@ pub enum UpdateFavoriteGroupError { /// Add a new favorite. Friend groups are named `group_0` through `group_3`. Avatar and World groups are named `avatars1` to `avatars4` and `worlds1` to `worlds4`. You cannot add people whom you are not friends with to your friends list. Destroying a friendship removes the person as favorite on both sides. -pub fn add_favorite(configuration: &configuration::Configuration, add_favorite_request: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/favorites", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(&add_favorite_request); - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn add_favorite(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, add_favorite_request: Option) -> Result> { + let local_var_uri_str = format!("{}/favorites", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, Some(add_favorite_request)).await } /// Clear ALL contents of a specific favorite group. -pub fn clear_favorite_group(configuration: &configuration::Configuration, favorite_group_type: &str, favorite_group_name: &str, user_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/favorite/group/{favoriteGroupType}/{favoriteGroupName}/{userId}", local_var_configuration.base_path, favoriteGroupType=crate::apis::urlencode(favorite_group_type), favoriteGroupName=crate::apis::urlencode(favorite_group_name), userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn clear_favorite_group(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, favorite_group_type: &str, favorite_group_name: &str, user_id: &str) -> Result> { + let local_var_uri_str = format!("{}/favorite/group/{favoriteGroupType}/{favoriteGroupName}/{userId}", configuration.base_path, favoriteGroupType=crate::apis::urlencode(favorite_group_type), favoriteGroupName=crate::apis::urlencode(favorite_group_name), userId=crate::apis::urlencode(user_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Return information about a specific Favorite. -pub fn get_favorite(configuration: &configuration::Configuration, favorite_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/favorites/{favoriteId}", local_var_configuration.base_path, favoriteId=crate::apis::urlencode(favorite_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_favorite(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, favorite_id: &str) -> Result> { + let local_var_uri_str = format!("{}/favorites/{favoriteId}", configuration.base_path, favoriteId=crate::apis::urlencode(favorite_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Fetch information about a specific favorite group. -pub fn get_favorite_group(configuration: &configuration::Configuration, favorite_group_type: &str, favorite_group_name: &str, user_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/favorite/group/{favoriteGroupType}/{favoriteGroupName}/{userId}", local_var_configuration.base_path, favoriteGroupType=crate::apis::urlencode(favorite_group_type), favoriteGroupName=crate::apis::urlencode(favorite_group_name), userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_favorite_group(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, favorite_group_type: &str, favorite_group_name: &str, user_id: &str) -> Result> { + let local_var_uri_str = format!("{}/favorite/group/{favoriteGroupType}/{favoriteGroupName}/{userId}", configuration.base_path, favoriteGroupType=crate::apis::urlencode(favorite_group_type), favoriteGroupName=crate::apis::urlencode(favorite_group_name), userId=crate::apis::urlencode(user_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Return a list of favorite groups owned by a user. Returns the same information as `getFavoriteGroups`. -pub fn get_favorite_groups(configuration: &configuration::Configuration, n: Option, offset: Option, owner_id: Option<&str>) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/favorite/groups", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); +pub async fn get_favorite_groups(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, n: Option, offset: Option, owner_id: Option<&str>) -> Result, Error> { + let local_var_uri_str = format!("{}/favorite/groups", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); @@ -209,33 +120,13 @@ pub fn get_favorite_groups(configuration: &configuration::Configuration, n: Opti if let Some(ref local_var_str) = owner_id { local_var_req_builder = local_var_req_builder.query(&[("ownerId", &local_var_str.to_string())]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Returns a list of favorites. -pub fn get_favorites(configuration: &configuration::Configuration, n: Option, offset: Option, r#type: Option<&str>, tag: Option<&str>) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/favorites", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); +pub async fn get_favorites(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, n: Option, offset: Option, r#type: Option<&str>, tag: Option<&str>) -> Result, Error> { + let local_var_uri_str = format!("{}/favorites", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); @@ -249,79 +140,20 @@ pub fn get_favorites(configuration: &configuration::Configuration, n: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Remove a favorite from your favorites list. -pub fn remove_favorite(configuration: &configuration::Configuration, favorite_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/favorites/{favoriteId}", local_var_configuration.base_path, favoriteId=crate::apis::urlencode(favorite_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn remove_favorite(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, favorite_id: &str) -> Result> { + let local_var_uri_str = format!("{}/favorites/{favoriteId}", configuration.base_path, favoriteId=crate::apis::urlencode(favorite_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Update information about a specific favorite group. -pub fn update_favorite_group(configuration: &configuration::Configuration, favorite_group_type: &str, favorite_group_name: &str, user_id: &str, update_favorite_group_request: Option) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/favorite/group/{favoriteGroupType}/{favoriteGroupName}/{userId}", local_var_configuration.base_path, favoriteGroupType=crate::apis::urlencode(favorite_group_type), favoriteGroupName=crate::apis::urlencode(favorite_group_name), userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(&update_favorite_group_request); - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn update_favorite_group(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, favorite_group_type: &str, favorite_group_name: &str, user_id: &str, update_favorite_group_request: Option) -> Result<(), Error> { + let local_var_uri_str = format!("{}/favorite/group/{favoriteGroupType}/{favoriteGroupName}/{userId}", configuration.base_path, favoriteGroupType=crate::apis::urlencode(favorite_group_type), favoriteGroupName=crate::apis::urlencode(favorite_group_name), userId=crate::apis::urlencode(user_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + crate::request_ok(configuration, local_var_req_builder, Some(update_favorite_group_request)).await } diff --git a/src/apis/files_api.rs b/src/apis/files_api.rs index 7367685..52bed42 100644 --- a/src/apis/files_api.rs +++ b/src/apis/files_api.rs @@ -9,7 +9,7 @@ use reqwest; -use crate::apis::ResponseContent; +#[allow(unused_imports)] use crate::apis::ResponseContent; use super::{Error, configuration}; @@ -90,240 +90,65 @@ pub enum StartFileDataUploadError { /// Creates a new File object -pub fn create_file(configuration: &configuration::Configuration, create_file_request: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/file", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(&create_file_request); - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn create_file(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, create_file_request: Option) -> Result> { + let local_var_uri_str = format!("{}/file", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, Some(create_file_request)).await } /// Creates a new FileVersion. Once a Version has been created, proceed to the `/file/{fileId}/{versionId}/file/start` endpoint to start a file upload. -pub fn create_file_version(configuration: &configuration::Configuration, file_id: &str, create_file_version_request: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/file/{fileId}", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(&create_file_version_request); - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn create_file_version(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, file_id: &str, create_file_version_request: Option) -> Result> { + let local_var_uri_str = format!("{}/file/{fileId}", configuration.base_path, fileId=crate::apis::urlencode(file_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, Some(create_file_version_request)).await } /// Deletes a File object. -pub fn delete_file(configuration: &configuration::Configuration, file_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/file/{fileId}", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn delete_file(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, file_id: &str) -> Result> { + let local_var_uri_str = format!("{}/file/{fileId}", configuration.base_path, fileId=crate::apis::urlencode(file_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Delete a specific version of a file. You can only delete the latest version. -pub fn delete_file_version(configuration: &configuration::Configuration, file_id: &str, version_id: i32) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/file/{fileId}/{versionId}", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id), versionId=version_id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn delete_file_version(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, file_id: &str, version_id: i32) -> Result> { + let local_var_uri_str = format!("{}/file/{fileId}/{versionId}", configuration.base_path, fileId=crate::apis::urlencode(file_id), versionId=version_id); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Downloads the file with the provided version number. **Version Note:** Version 0 is always when the file was created. The real data is usually always located in version 1 and up. **Extension Note:** Files are not guaranteed to have a file extensions. UnityPackage files tends to have it, images through this endpoint do not. You are responsible for appending file extension from the `extension` field when neccesary. -pub fn download_file_version(configuration: &configuration::Configuration, file_id: &str, version_id: i32) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/file/{fileId}/{versionId}", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id), versionId=version_id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn download_file_version(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, file_id: &str, version_id: i32) -> Result<(), Error> { + let local_var_uri_str = format!("{}/file/{fileId}/{versionId}", configuration.base_path, fileId=crate::apis::urlencode(file_id), versionId=version_id); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request_ok(configuration, local_var_req_builder, None::<()>).await } /// Finish an upload of a FileData. This will mark it as \"complete\". After uploading the `file` for Avatars and Worlds you then have to upload a `signature` file. -pub fn finish_file_data_upload(configuration: &configuration::Configuration, file_id: &str, version_id: i32, file_type: &str, finish_file_data_upload_request: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/file/{fileId}/{versionId}/{fileType}/finish", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id), versionId=version_id, fileType=crate::apis::urlencode(file_type)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(&finish_file_data_upload_request); - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn finish_file_data_upload(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, file_id: &str, version_id: i32, file_type: &str, finish_file_data_upload_request: Option) -> Result> { + let local_var_uri_str = format!("{}/file/{fileId}/{versionId}/{fileType}/finish", configuration.base_path, fileId=crate::apis::urlencode(file_id), versionId=version_id, fileType=crate::apis::urlencode(file_type)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, Some(finish_file_data_upload_request)).await } /// Shows general information about the \"File\" object. Each File can have several \"Version\"'s, and each Version can have multiple real files or \"Data\" blobs. -pub fn get_file(configuration: &configuration::Configuration, file_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/file/{fileId}", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_file(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, file_id: &str) -> Result> { + let local_var_uri_str = format!("{}/file/{fileId}", configuration.base_path, fileId=crate::apis::urlencode(file_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Retrieves the upload status for file upload. Can currently only be accessed when `status` is `waiting`. Trying to access it on a file version already uploaded currently times out. -pub fn get_file_data_upload_status(configuration: &configuration::Configuration, file_id: &str, version_id: i32, file_type: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/file/{fileId}/{versionId}/{fileType}/status", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id), versionId=version_id, fileType=crate::apis::urlencode(file_type)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_file_data_upload_status(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, file_id: &str, version_id: i32, file_type: &str) -> Result> { + let local_var_uri_str = format!("{}/file/{fileId}/{versionId}/{fileType}/status", configuration.base_path, fileId=crate::apis::urlencode(file_id), versionId=version_id, fileType=crate::apis::urlencode(file_type)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Returns a list of files -pub fn get_files(configuration: &configuration::Configuration, tag: Option<&str>, user_id: Option<&str>, n: Option, offset: Option) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/files", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); +pub async fn get_files(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, tag: Option<&str>, user_id: Option<&str>, n: Option, offset: Option) -> Result, Error> { + let local_var_uri_str = format!("{}/files", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = tag { local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]); @@ -337,53 +162,17 @@ pub fn get_files(configuration: &configuration::Configuration, tag: Option<&str> if let Some(ref local_var_str) = offset { local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Starts an upload of a specific FilePart. This endpoint will return an AWS URL which you can PUT data to. You need to call this and receive a new AWS API URL for each `partNumber`. Please see AWS's REST documentation on \"PUT Object to S3\" on how to upload. Once all parts has been uploaded, proceed to `/finish` endpoint. **Note:** `nextPartNumber` seems like it is always ignored. Despite it returning 0, first partNumber is always 1. -pub fn start_file_data_upload(configuration: &configuration::Configuration, file_id: &str, version_id: i32, file_type: &str, part_number: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/file/{fileId}/{versionId}/{fileType}/start", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id), versionId=version_id, fileType=crate::apis::urlencode(file_type)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); +pub async fn start_file_data_upload(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, file_id: &str, version_id: i32, file_type: &str, part_number: Option) -> Result> { + let local_var_uri_str = format!("{}/file/{fileId}/{versionId}/{fileType}/start", configuration.base_path, fileId=crate::apis::urlencode(file_id), versionId=version_id, fileType=crate::apis::urlencode(file_type)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_str) = part_number { local_var_req_builder = local_var_req_builder.query(&[("partNumber", &local_var_str.to_string())]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } + crate::request(configuration, local_var_req_builder, None::<()>).await } diff --git a/src/apis/friends_api.rs b/src/apis/friends_api.rs index ad8265c..844dded 100644 --- a/src/apis/friends_api.rs +++ b/src/apis/friends_api.rs @@ -9,7 +9,7 @@ use reqwest; -use crate::apis::ResponseContent; +#[allow(unused_imports)] use crate::apis::ResponseContent; use super::{Error, configuration}; @@ -26,6 +26,7 @@ pub enum DeleteFriendRequestError { #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum FriendError { + Status400(crate::models::Error), Status401(crate::models::Error), Status404(crate::models::Error), UnknownValue(serde_json::Value), @@ -58,97 +59,30 @@ pub enum UnfriendError { /// Deletes an outgoing pending friend request to another user. To delete an incoming friend request, use the `deleteNotification` endpoint instead. -pub fn delete_friend_request(configuration: &configuration::Configuration, user_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/user/{userId}/friendRequest", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn delete_friend_request(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, user_id: &str) -> Result> { + let local_var_uri_str = format!("{}/user/{userId}/friendRequest", configuration.base_path, userId=crate::apis::urlencode(user_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Send a friend request to another user. -pub fn friend(configuration: &configuration::Configuration, user_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/user/{userId}/friendRequest", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn friend(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, user_id: &str) -> Result> { + let local_var_uri_str = format!("{}/user/{userId}/friendRequest", configuration.base_path, userId=crate::apis::urlencode(user_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Retrieve if the user is currently a friend with a given user, if they have an outgoing friend request, and if they have an incoming friend request. The proper way to receive and accept friend request is by checking if the user has an incoming `Notification` of type `friendRequest`, and then accepting that notification. -pub fn get_friend_status(configuration: &configuration::Configuration, user_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/user/{userId}/friendStatus", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_friend_status(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, user_id: &str) -> Result> { + let local_var_uri_str = format!("{}/user/{userId}/friendStatus", configuration.base_path, userId=crate::apis::urlencode(user_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// List information about friends. -pub fn get_friends(configuration: &configuration::Configuration, offset: Option, n: Option, offline: Option) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/auth/user/friends", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); +pub async fn get_friends(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, offset: Option, n: Option, offline: Option) -> Result, Error> { + let local_var_uri_str = format!("{}/auth/user/friends", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = offset { local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); @@ -159,50 +93,13 @@ pub fn get_friends(configuration: &configuration::Configuration, offset: Option< if let Some(ref local_var_str) = offline { local_var_req_builder = local_var_req_builder.query(&[("offline", &local_var_str.to_string())]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Unfriend a user by ID. -pub fn unfriend(configuration: &configuration::Configuration, user_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/auth/user/friends/{userId}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn unfriend(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, user_id: &str) -> Result> { + let local_var_uri_str = format!("{}/auth/user/friends/{userId}", configuration.base_path, userId=crate::apis::urlencode(user_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } diff --git a/src/apis/groups_api.rs b/src/apis/groups_api.rs index f6000c9..a696b61 100644 --- a/src/apis/groups_api.rs +++ b/src/apis/groups_api.rs @@ -9,7 +9,7 @@ use reqwest; -use crate::apis::ResponseContent; +#[allow(unused_imports)] use crate::apis::ResponseContent; use super::{Error, configuration}; @@ -31,10 +31,19 @@ pub enum AddGroupMemberRoleError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`add_group_post`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum AddGroupPostError { + Status401(crate::models::Error), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`ban_group_member`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum BanGroupMemberError { + Status400(crate::models::Error), Status401(crate::models::Error), Status404(crate::models::Error), UnknownValue(serde_json::Value), @@ -80,8 +89,9 @@ pub enum CreateGroupGalleryError { #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum CreateGroupInviteError { - Status400(), + Status400(crate::models::Error), Status401(crate::models::Error), + Status403(crate::models::Error), Status404(crate::models::Error), UnknownValue(serde_json::Value), } @@ -136,10 +146,20 @@ pub enum DeleteGroupGalleryImageError { #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum DeleteGroupInviteError { + Status400(crate::models::Error), Status401(crate::models::Error), UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`delete_group_post`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeleteGroupPostError { + Status401(crate::models::Error), + Status404(crate::models::Success), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`delete_group_role`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -194,6 +214,15 @@ pub enum GetGroupGalleryImagesError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`get_group_instances`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetGroupInstancesError { + Status401(crate::models::Error), + Status404(crate::models::Error), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`get_group_invites`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -233,10 +262,19 @@ pub enum GetGroupPermissionsError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`get_group_post`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetGroupPostError { + Status401(crate::models::Error), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`get_group_requests`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum GetGroupRequestsError { + Status400(crate::models::Error), Status403(crate::models::Error), Status404(crate::models::Error), UnknownValue(serde_json::Value), @@ -298,6 +336,14 @@ pub enum RespondGroupJoinRequestError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`search_groups`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum SearchGroupsError { + Status401(crate::models::Error), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`unban_group_member`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -334,6 +380,15 @@ pub enum UpdateGroupMemberError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`update_group_post`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UpdateGroupPostError { + Status401(crate::models::Error), + Status404(crate::models::Success), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`update_group_role`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -344,499 +399,146 @@ pub enum UpdateGroupRoleError { /// Adds an image to a Group gallery. -pub fn add_group_gallery_image(configuration: &configuration::Configuration, group_id: &str, group_gallery_id: &str, add_group_gallery_image_request: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}/galleries/{groupGalleryId}/images", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), groupGalleryId=crate::apis::urlencode(group_gallery_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(&add_group_gallery_image_request); - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn add_group_gallery_image(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str, group_gallery_id: &str, add_group_gallery_image_request: crate::models::AddGroupGalleryImageRequest) -> Result> { + let local_var_uri_str = format!("{}/groups/{groupId}/galleries/{groupGalleryId}/images", configuration.base_path, groupId=crate::apis::urlencode(group_id), groupGalleryId=crate::apis::urlencode(group_gallery_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, Some(add_group_gallery_image_request)).await } /// Adds a Role to a Group Member -pub fn add_group_member_role(configuration: &configuration::Configuration, group_id: &str, user_id: &str, group_role_id: &str) -> Result, Error> { - let local_var_configuration = configuration; +pub async fn add_group_member_role(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str, user_id: &str, group_role_id: &str) -> Result, Error> { + let local_var_uri_str = format!("{}/groups/{groupId}/members/{userId}/roles/{groupRoleId}", configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id), groupRoleId=crate::apis::urlencode(group_role_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await +} - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}/members/{userId}/roles/{groupRoleId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id), groupRoleId=crate::apis::urlencode(group_role_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +/// Create a post in a Group. +pub async fn add_group_post(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str, create_group_post_request: crate::models::CreateGroupPostRequest) -> Result> { + let local_var_uri_str = format!("{}/groups/{groupId}/posts", configuration.base_path, groupId=crate::apis::urlencode(group_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, Some(create_group_post_request)).await } /// Bans a user from a Group. -pub fn ban_group_member(configuration: &configuration::Configuration, group_id: &str, ban_group_member_request: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}/bans", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(&ban_group_member_request); - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn ban_group_member(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str, ban_group_member_request: crate::models::BanGroupMemberRequest) -> Result> { + let local_var_uri_str = format!("{}/groups/{groupId}/bans", configuration.base_path, groupId=crate::apis::urlencode(group_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, Some(ban_group_member_request)).await } /// Cancels a request sent to join the group. -pub fn cancel_group_request(configuration: &configuration::Configuration, group_id: &str) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}/requests", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn cancel_group_request(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str) -> Result<(), Error> { + let local_var_uri_str = format!("{}/groups/{groupId}/requests", configuration.base_path, groupId=crate::apis::urlencode(group_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + crate::request_ok(configuration, local_var_req_builder, None::<()>).await } /// Creates a Group and returns a Group object. **Requires VRC+ Subscription.** -pub fn create_group(configuration: &configuration::Configuration, create_group_request: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(&create_group_request); - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn create_group(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, create_group_request: crate::models::CreateGroupRequest) -> Result> { + let local_var_uri_str = format!("{}/groups", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, Some(create_group_request)).await } /// Creates an Announcement for a Group. -pub fn create_group_announcement(configuration: &configuration::Configuration, group_id: &str, create_group_announcement_request: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}/announcement", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(&create_group_announcement_request); - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn create_group_announcement(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str, create_group_announcement_request: crate::models::CreateGroupAnnouncementRequest) -> Result> { + let local_var_uri_str = format!("{}/groups/{groupId}/announcement", configuration.base_path, groupId=crate::apis::urlencode(group_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, Some(create_group_announcement_request)).await } /// Creates a gallery for a Group. -pub fn create_group_gallery(configuration: &configuration::Configuration, group_id: &str, create_group_gallery_request: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}/galleries", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(&create_group_gallery_request); - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn create_group_gallery(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str, create_group_gallery_request: crate::models::CreateGroupGalleryRequest) -> Result> { + let local_var_uri_str = format!("{}/groups/{groupId}/galleries", configuration.base_path, groupId=crate::apis::urlencode(group_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, Some(create_group_gallery_request)).await } /// Sends an invite to a user to join the group. -pub fn create_group_invite(configuration: &configuration::Configuration, group_id: &str, create_group_invite_request: Option) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}/invites", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(&create_group_invite_request); - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn create_group_invite(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str, create_group_invite_request: crate::models::CreateGroupInviteRequest) -> Result<(), Error> { + let local_var_uri_str = format!("{}/groups/{groupId}/invites", configuration.base_path, groupId=crate::apis::urlencode(group_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + crate::request_ok(configuration, local_var_req_builder, Some(create_group_invite_request)).await } /// Create a Group role. -pub fn create_group_role(configuration: &configuration::Configuration, group_id: &str, create_group_role_request: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}/roles", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(&create_group_role_request); - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn create_group_role(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str, create_group_role_request: crate::models::CreateGroupRoleRequest) -> Result> { + let local_var_uri_str = format!("{}/groups/{groupId}/roles", configuration.base_path, groupId=crate::apis::urlencode(group_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, Some(create_group_role_request)).await } /// Deletes a Group. -pub fn delete_group(configuration: &configuration::Configuration, group_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn delete_group(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str) -> Result> { + let local_var_uri_str = format!("{}/groups/{groupId}", configuration.base_path, groupId=crate::apis::urlencode(group_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Deletes the announcement for a Group. -pub fn delete_group_announcement(configuration: &configuration::Configuration, group_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}/announcement", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn delete_group_announcement(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str) -> Result> { + let local_var_uri_str = format!("{}/groups/{groupId}/announcement", configuration.base_path, groupId=crate::apis::urlencode(group_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Deletes a gallery for a Group. -pub fn delete_group_gallery(configuration: &configuration::Configuration, group_id: &str, group_gallery_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}/galleries/{groupGalleryId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), groupGalleryId=crate::apis::urlencode(group_gallery_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn delete_group_gallery(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str, group_gallery_id: &str) -> Result> { + let local_var_uri_str = format!("{}/groups/{groupId}/galleries/{groupGalleryId}", configuration.base_path, groupId=crate::apis::urlencode(group_id), groupGalleryId=crate::apis::urlencode(group_gallery_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Deletes an image from a Group gallery. -pub fn delete_group_gallery_image(configuration: &configuration::Configuration, group_id: &str, group_gallery_id: &str, group_gallery_image_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}/galleries/{groupGalleryId}/images/{groupGalleryImageId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), groupGalleryId=crate::apis::urlencode(group_gallery_id), groupGalleryImageId=crate::apis::urlencode(group_gallery_image_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn delete_group_gallery_image(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str, group_gallery_id: &str, group_gallery_image_id: &str) -> Result> { + let local_var_uri_str = format!("{}/groups/{groupId}/galleries/{groupGalleryId}/images/{groupGalleryImageId}", configuration.base_path, groupId=crate::apis::urlencode(group_id), groupGalleryId=crate::apis::urlencode(group_gallery_id), groupGalleryImageId=crate::apis::urlencode(group_gallery_image_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Deletes an Group invite sent to a User -pub fn delete_group_invite(configuration: &configuration::Configuration, group_id: &str, user_id: &str) -> Result<(), Error> { - let local_var_configuration = configuration; +pub async fn delete_group_invite(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str, user_id: &str) -> Result<(), Error> { + let local_var_uri_str = format!("{}/groups/{groupId}/invites/{userId}", configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + crate::request_ok(configuration, local_var_req_builder, None::<()>).await +} - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}/invites/{userId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +/// Delete a Group post +pub async fn delete_group_post(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str, notification_id: &str) -> Result> { + let local_var_uri_str = format!("{}/groups/{groupId}/posts/{notificationId}", configuration.base_path, groupId=crate::apis::urlencode(group_id), notificationId=crate::apis::urlencode(notification_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Deletes a Group Role by ID and returns the remaining roles. -pub fn delete_group_role(configuration: &configuration::Configuration, group_id: &str, group_role_id: &str) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}/roles/{groupRoleId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), groupRoleId=crate::apis::urlencode(group_role_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn delete_group_role(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str, group_role_id: &str) -> Result, Error> { + let local_var_uri_str = format!("{}/groups/{groupId}/roles/{groupRoleId}", configuration.base_path, groupId=crate::apis::urlencode(group_id), groupRoleId=crate::apis::urlencode(group_role_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Returns a single Group by ID. -pub fn get_group(configuration: &configuration::Configuration, group_id: &str, include_roles: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); +pub async fn get_group(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str, include_roles: Option) -> Result> { + let local_var_uri_str = format!("{}/groups/{groupId}", configuration.base_path, groupId=crate::apis::urlencode(group_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = include_roles { local_var_req_builder = local_var_req_builder.query(&[("includeRoles", &local_var_str.to_string())]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Returns the announcement for a Group. If no announcement has been made, then it returns **empty object**. If an announcement exists, then it will always return all fields except `imageId` and `imageUrl` which may be null. -pub fn get_group_announcements(configuration: &configuration::Configuration, group_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}/announcement", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_group_announcements(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str) -> Result> { + let local_var_uri_str = format!("{}/groups/{groupId}/announcement", configuration.base_path, groupId=crate::apis::urlencode(group_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Returns a list of audit logs for a Group. -pub fn get_group_audit_logs(configuration: &configuration::Configuration, group_id: &str, n: Option, offset: Option, start_date: Option, end_date: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}/auditLogs", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); +pub async fn get_group_audit_logs(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str, n: Option, offset: Option, start_date: Option, end_date: Option) -> Result> { + let local_var_uri_str = format!("{}/groups/{groupId}/auditLogs", configuration.base_path, groupId=crate::apis::urlencode(group_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); @@ -850,33 +552,13 @@ pub fn get_group_audit_logs(configuration: &configuration::Configuration, group_ if let Some(ref local_var_str) = end_date { local_var_req_builder = local_var_req_builder.query(&[("endDate", &local_var_str.to_string())]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Returns a list of banned users for a Group. -pub fn get_group_bans(configuration: &configuration::Configuration, group_id: &str, n: Option, offset: Option) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}/bans", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); +pub async fn get_group_bans(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str, n: Option, offset: Option) -> Result, Error> { + let local_var_uri_str = format!("{}/groups/{groupId}/bans", configuration.base_path, groupId=crate::apis::urlencode(group_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); @@ -884,33 +566,13 @@ pub fn get_group_bans(configuration: &configuration::Configuration, group_id: &s if let Some(ref local_var_str) = offset { local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Returns a list of images for a Group gallery. -pub fn get_group_gallery_images(configuration: &configuration::Configuration, group_id: &str, group_gallery_id: &str, n: Option, offset: Option, approved: Option) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}/galleries/{groupGalleryId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), groupGalleryId=crate::apis::urlencode(group_gallery_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); +pub async fn get_group_gallery_images(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str, group_gallery_id: &str, n: Option, offset: Option, approved: Option) -> Result, Error> { + let local_var_uri_str = format!("{}/groups/{groupId}/galleries/{groupGalleryId}", configuration.base_path, groupId=crate::apis::urlencode(group_id), groupGalleryId=crate::apis::urlencode(group_gallery_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); @@ -921,89 +583,20 @@ pub fn get_group_gallery_images(configuration: &configuration::Configuration, gr if let Some(ref local_var_str) = approved { local_var_req_builder = local_var_req_builder.query(&[("approved", &local_var_str.to_string())]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } + crate::request(configuration, local_var_req_builder, None::<()>).await +} - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +/// Returns a list of group instances +pub async fn get_group_instances(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str) -> Result, Error> { + let local_var_uri_str = format!("{}/groups/{groupId}/instances", configuration.base_path, groupId=crate::apis::urlencode(group_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Returns a list of members that have been invited to the Group. -pub fn get_group_invites(configuration: &configuration::Configuration, group_id: &str) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}/invites", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// Returns a LimitedGroup Member. -pub fn get_group_member(configuration: &configuration::Configuration, group_id: &str, user_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}/members/{userId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } -} - -/// Returns a List of all **other** Group Members. This endpoint will never return the user calling the endpoint. Information about the user calling the endpoint must be found in the `myMember` field of the Group object. -pub fn get_group_members(configuration: &configuration::Configuration, group_id: &str, n: Option, offset: Option) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}/members", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); +pub async fn get_group_invites(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str, n: Option, offset: Option) -> Result, Error> { + let local_var_uri_str = format!("{}/groups/{groupId}/invites", configuration.base_path, groupId=crate::apis::urlencode(group_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); @@ -1011,391 +604,172 @@ pub fn get_group_members(configuration: &configuration::Configuration, group_id: if let Some(ref local_var_str) = offset { local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + crate::request(configuration, local_var_req_builder, None::<()>).await +} + +/// Returns a LimitedGroup Member. +pub async fn get_group_member(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str, user_id: &str) -> Result> { + let local_var_uri_str = format!("{}/groups/{groupId}/members/{userId}", configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await +} + +/// Returns a List of all **other** Group Members. This endpoint will never return the user calling the endpoint. Information about the user calling the endpoint must be found in the `myMember` field of the Group object. +pub async fn get_group_members(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str, n: Option, offset: Option, sort: Option) -> Result, Error> { + let local_var_uri_str = format!("{}/groups/{groupId}/members", configuration.base_path, groupId=crate::apis::urlencode(group_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = n { + local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + if let Some(ref local_var_str) = offset { + local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } + if let Some(ref local_var_str) = sort { + local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); + } + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Returns a List of all possible/available permissions for a Group. -pub fn get_group_permissions(configuration: &configuration::Configuration, group_id: &str) -> Result, Error> { - let local_var_configuration = configuration; +pub async fn get_group_permissions(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str) -> Result, Error> { + let local_var_uri_str = format!("{}/groups/{groupId}/permissions", configuration.base_path, groupId=crate::apis::urlencode(group_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await +} - let local_var_client = &local_var_configuration.client; +/// Get posts from a Group +pub async fn get_group_post(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str, n: Option, offset: Option, public_only: Option) -> Result> { + let local_var_uri_str = format!("{}/groups/{groupId}/posts", configuration.base_path, groupId=crate::apis::urlencode(group_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - let local_var_uri_str = format!("{}/groups/{groupId}/permissions", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref local_var_str) = n { + local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + if let Some(ref local_var_str) = offset { + local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } + if let Some(ref local_var_str) = public_only { + local_var_req_builder = local_var_req_builder.query(&[("publicOnly", &local_var_str.to_string())]); + } + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Returns a list of members that have requested to join the Group. -pub fn get_group_requests(configuration: &configuration::Configuration, group_id: &str) -> Result, Error> { - let local_var_configuration = configuration; +pub async fn get_group_requests(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str, n: Option, offset: Option, blocked: Option) -> Result, Error> { + let local_var_uri_str = format!("{}/groups/{groupId}/requests", configuration.base_path, groupId=crate::apis::urlencode(group_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}/requests", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref local_var_str) = n { + local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + if let Some(ref local_var_str) = offset { + local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } + if let Some(ref local_var_str) = blocked { + local_var_req_builder = local_var_req_builder.query(&[("blocked", &local_var_str.to_string())]); + } + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Returns a Group Role by ID. -pub fn get_group_roles(configuration: &configuration::Configuration, group_id: &str) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}/roles", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_group_roles(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str) -> Result, Error> { + let local_var_uri_str = format!("{}/groups/{groupId}/roles", configuration.base_path, groupId=crate::apis::urlencode(group_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Join a Group by ID and returns the member object. -pub fn join_group(configuration: &configuration::Configuration, group_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}/join", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn join_group(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str) -> Result> { + let local_var_uri_str = format!("{}/groups/{groupId}/join", configuration.base_path, groupId=crate::apis::urlencode(group_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Kicks a Group Member from the Group. The current user must have the \"Remove Group Members\" permission. -pub fn kick_group_member(configuration: &configuration::Configuration, group_id: &str, user_id: &str) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}/members/{userId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn kick_group_member(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str, user_id: &str) -> Result<(), Error> { + let local_var_uri_str = format!("{}/groups/{groupId}/members/{userId}", configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + crate::request_ok(configuration, local_var_req_builder, None::<()>).await } /// Leave a group by ID. -pub fn leave_group(configuration: &configuration::Configuration, group_id: &str) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}/leave", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn leave_group(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str) -> Result<(), Error> { + let local_var_uri_str = format!("{}/groups/{groupId}/leave", configuration.base_path, groupId=crate::apis::urlencode(group_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + crate::request_ok(configuration, local_var_req_builder, None::<()>).await } /// Removes a Role from a Group Member -pub fn remove_group_member_role(configuration: &configuration::Configuration, group_id: &str, user_id: &str, group_role_id: &str) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}/members/{userId}/roles/{groupRoleId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id), groupRoleId=crate::apis::urlencode(group_role_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn remove_group_member_role(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str, user_id: &str, group_role_id: &str) -> Result, Error> { + let local_var_uri_str = format!("{}/groups/{groupId}/members/{userId}/roles/{groupRoleId}", configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id), groupRoleId=crate::apis::urlencode(group_role_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Responds to a Group Join Request with Accept/Deny -pub fn respond_group_join_request(configuration: &configuration::Configuration, group_id: &str, user_id: &str, respond_group_join_request: Option) -> Result<(), Error> { - let local_var_configuration = configuration; +pub async fn respond_group_join_request(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str, user_id: &str, respond_group_join_request: crate::models::RespondGroupJoinRequest) -> Result<(), Error> { + let local_var_uri_str = format!("{}/groups/{groupId}/requests/{userId}", configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + crate::request_ok(configuration, local_var_req_builder, Some(respond_group_join_request)).await +} - let local_var_client = &local_var_configuration.client; +/// Searches Groups by name or shortCode +pub async fn search_groups(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, query: Option<&str>, offset: Option, n: Option) -> Result, Error> { + let local_var_uri_str = format!("{}/groups", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - let local_var_uri_str = format!("{}/groups/{groupId}/requests/{userId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + if let Some(ref local_var_str) = query { + local_var_req_builder = local_var_req_builder.query(&[("query", &local_var_str.to_string())]); } - local_var_req_builder = local_var_req_builder.json(&respond_group_join_request); - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) + if let Some(ref local_var_str) = offset { + local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } + if let Some(ref local_var_str) = n { + local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); + } + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Unbans a user from a Group. -pub fn unban_group_member(configuration: &configuration::Configuration, group_id: &str, user_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}/bans/{userId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn unban_group_member(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str, user_id: &str) -> Result> { + let local_var_uri_str = format!("{}/groups/{groupId}/bans/{userId}", configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Updates a Group and returns it. -pub fn update_group(configuration: &configuration::Configuration, group_id: &str, update_group_request: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(&update_group_request); - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn update_group(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str, update_group_request: Option) -> Result> { + let local_var_uri_str = format!("{}/groups/{groupId}", configuration.base_path, groupId=crate::apis::urlencode(group_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, Some(update_group_request)).await } /// Updates a gallery for a Group. -pub fn update_group_gallery(configuration: &configuration::Configuration, group_id: &str, group_gallery_id: &str, update_group_gallery_request: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}/galleries/{groupGalleryId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), groupGalleryId=crate::apis::urlencode(group_gallery_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(&update_group_gallery_request); - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn update_group_gallery(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str, group_gallery_id: &str, update_group_gallery_request: Option) -> Result> { + let local_var_uri_str = format!("{}/groups/{groupId}/galleries/{groupGalleryId}", configuration.base_path, groupId=crate::apis::urlencode(group_id), groupGalleryId=crate::apis::urlencode(group_gallery_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, Some(update_group_gallery_request)).await } /// Updates a Group Member -pub fn update_group_member(configuration: &configuration::Configuration, group_id: &str, user_id: &str, update_group_member_request: Option) -> Result> { - let local_var_configuration = configuration; +pub async fn update_group_member(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str, user_id: &str, update_group_member_request: Option) -> Result> { + let local_var_uri_str = format!("{}/groups/{groupId}/members/{userId}", configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, Some(update_group_member_request)).await +} - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}/members/{userId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(&update_group_member_request); - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +/// Edits a Group post +pub async fn update_group_post(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str, notification_id: &str, create_group_post_request: crate::models::CreateGroupPostRequest) -> Result> { + let local_var_uri_str = format!("{}/groups/{groupId}/posts/{notificationId}", configuration.base_path, groupId=crate::apis::urlencode(group_id), notificationId=crate::apis::urlencode(notification_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, Some(create_group_post_request)).await } /// Updates a group role by ID. -pub fn update_group_role(configuration: &configuration::Configuration, group_id: &str, group_role_id: &str, update_group_role_request: Option) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/groups/{groupId}/roles/{groupRoleId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), groupRoleId=crate::apis::urlencode(group_role_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(&update_group_role_request); - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn update_group_role(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, group_id: &str, group_role_id: &str, update_group_role_request: Option) -> Result, Error> { + let local_var_uri_str = format!("{}/groups/{groupId}/roles/{groupRoleId}", configuration.base_path, groupId=crate::apis::urlencode(group_id), groupRoleId=crate::apis::urlencode(group_role_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, Some(update_group_role_request)).await } diff --git a/src/apis/instances_api.rs b/src/apis/instances_api.rs index de5c3cb..2a6e8c3 100644 --- a/src/apis/instances_api.rs +++ b/src/apis/instances_api.rs @@ -9,10 +9,28 @@ use reqwest; -use crate::apis::ResponseContent; +#[allow(unused_imports)] use crate::apis::ResponseContent; use super::{Error, configuration}; +/// struct for typed errors of method [`close_instance`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CloseInstanceError { + Status401(crate::models::Error), + Status403(crate::models::Error), + Status404(crate::models::Error), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`create_instance`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CreateInstanceError { + Status401(crate::models::Error), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`get_instance`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -47,115 +65,52 @@ pub enum SendSelfInviteError { } +/// Close an instance or update the closedAt time when it will be closed. You can only close an instance if the ownerId is yourself or if the instance owner is a group and you have the `group-instance-moderate` permission. +pub async fn close_instance(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, world_id: &str, instance_id: &str, hard_close: Option, closed_at: Option) -> Result> { + let local_var_uri_str = format!("{}/instances/{worldId}:{instanceId}", configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + + if let Some(ref local_var_str) = hard_close { + local_var_req_builder = local_var_req_builder.query(&[("hardClose", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = closed_at { + local_var_req_builder = local_var_req_builder.query(&[("closedAt", &local_var_str.to_string())]); + } + crate::request(configuration, local_var_req_builder, None::<()>).await +} + +/// Create an instance +pub async fn create_instance(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, create_instance_request: crate::models::CreateInstanceRequest) -> Result> { + let local_var_uri_str = format!("{}/instances", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, Some(create_instance_request)).await +} + /// Returns an instance. Please read [Instances Tutorial](https://vrchatapi.github.io/tutorials/instances/) for more information on Instances. If an invalid instanceId is provided, this endpoint will simply return \"null\"! -pub fn get_instance(configuration: &configuration::Configuration, world_id: &str, instance_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/instances/{worldId}:{instanceId}", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_instance(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, world_id: &str, instance_id: &str) -> Result> { + let local_var_uri_str = format!("{}/instances/{worldId}:{instanceId}", configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Returns an instance. Please read [Instances Tutorial](https://vrchatapi.github.io/tutorials/instances/) for more information on Instances. -pub fn get_instance_by_short_name(configuration: &configuration::Configuration, short_name: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/instances/s/{shortName}", local_var_configuration.base_path, shortName=crate::apis::urlencode(short_name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_instance_by_short_name(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, short_name: &str) -> Result> { + let local_var_uri_str = format!("{}/instances/s/{shortName}", configuration.base_path, shortName=crate::apis::urlencode(short_name)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Returns an instance short name. -pub fn get_short_name(configuration: &configuration::Configuration, world_id: &str, instance_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/instances/{worldId}:{instanceId}/shortName", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_short_name(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, world_id: &str, instance_id: &str) -> Result> { + let local_var_uri_str = format!("{}/instances/{worldId}:{instanceId}/shortName", configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Sends an invite to the instance to yourself. -pub fn send_self_invite(configuration: &configuration::Configuration, world_id: &str, instance_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/instances/{worldId}:{instanceId}/invite", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn send_self_invite(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, world_id: &str, instance_id: &str) -> Result> { + let local_var_uri_str = format!("{}/instances/{worldId}:{instanceId}/invite", configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } diff --git a/src/apis/invite_api.rs b/src/apis/invite_api.rs index cbe4a49..e7f5cd1 100644 --- a/src/apis/invite_api.rs +++ b/src/apis/invite_api.rs @@ -9,7 +9,7 @@ use reqwest; -use crate::apis::ResponseContent; +#[allow(unused_imports)] use crate::apis::ResponseContent; use super::{Error, configuration}; @@ -88,230 +88,58 @@ pub enum UpdateInviteMessageError { /// Returns a single Invite Message. This returns the exact same information but less than `getInviteMessages`. Admin Credentials are required to view messages of other users! Message type refers to a different collection of messages, used during different types of responses. * `message` = Message during a normal invite * `response` = Message when replying to a message * `request` = Message when requesting an invite * `requestResponse` = Message when replying to a request for invite -pub fn get_invite_message(configuration: &configuration::Configuration, user_id: &str, message_type: crate::models::InviteMessageType, slot: i32) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/message/{userId}/{messageType}/{slot}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id), messageType=message_type, slot=slot); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_invite_message(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, user_id: &str, message_type: crate::models::InviteMessageType, slot: i32) -> Result> { + let local_var_uri_str = format!("{}/message/{userId}/{messageType}/{slot}", configuration.base_path, userId=crate::apis::urlencode(user_id), messageType=message_type, slot=slot); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Returns a list of all the users Invite Messages. Admin Credentials are required to view messages of other users! Message type refers to a different collection of messages, used during different types of responses. * `message` = Message during a normal invite * `response` = Message when replying to a message * `request` = Message when requesting an invite * `requestResponse` = Message when replying to a request for invite -pub fn get_invite_messages(configuration: &configuration::Configuration, user_id: &str, message_type: crate::models::InviteMessageType) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/message/{userId}/{messageType}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id), messageType=message_type); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_invite_messages(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, user_id: &str, message_type: crate::models::InviteMessageType) -> Result, Error> { + let local_var_uri_str = format!("{}/message/{userId}/{messageType}", configuration.base_path, userId=crate::apis::urlencode(user_id), messageType=message_type); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Sends self an invite to an instance -pub fn invite_myself_to(configuration: &configuration::Configuration, world_id: &str, instance_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/invite/myself/to/{worldId}:{instanceId}", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn invite_myself_to(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, world_id: &str, instance_id: &str) -> Result> { + let local_var_uri_str = format!("{}/invite/myself/to/{worldId}:{instanceId}", configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Sends an invite to a user. Returns the Notification of type `invite` that was sent. -pub fn invite_user(configuration: &configuration::Configuration, user_id: &str, invite_request: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/invite/{userId}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(&invite_request); - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn invite_user(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, user_id: &str, invite_request: crate::models::InviteRequest) -> Result> { + let local_var_uri_str = format!("{}/invite/{userId}", configuration.base_path, userId=crate::apis::urlencode(user_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, Some(invite_request)).await } /// Requests an invite from a user. Returns the Notification of type `requestInvite` that was sent. -pub fn request_invite(configuration: &configuration::Configuration, user_id: &str, request_invite_request: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/requestInvite/{userId}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(&request_invite_request); - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn request_invite(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, user_id: &str, request_invite_request: Option) -> Result> { + let local_var_uri_str = format!("{}/requestInvite/{userId}", configuration.base_path, userId=crate::apis::urlencode(user_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, Some(request_invite_request)).await } /// Resets a single Invite Message back to its original message, and then returns a list of all of them. Admin Credentials are required to update messages of other users! Resetting a message respects the rate-limit, so it is not possible to reset within the 60 minutes countdown. Resetting it does however not set the rate-limit to 60 like when editing it. It is possible to edit it right after resetting it. Trying to edit a message before the cooldown timer expires results in a 429 \"Too Fast Error\". Message type refers to a different collection of messages, used during different types of responses. * `message` = Message during a normal invite * `response` = Message when replying to a message * `request` = Message when requesting an invite * `requestResponse` = Message when replying to a request for invite The DELETE endpoint does not have/require any request body. -pub fn reset_invite_message(configuration: &configuration::Configuration, user_id: &str, message_type: crate::models::InviteMessageType, slot: i32) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/message/{userId}/{messageType}/{slot}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id), messageType=message_type, slot=slot); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn reset_invite_message(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, user_id: &str, message_type: crate::models::InviteMessageType, slot: i32) -> Result, Error> { + let local_var_uri_str = format!("{}/message/{userId}/{messageType}/{slot}", configuration.base_path, userId=crate::apis::urlencode(user_id), messageType=message_type, slot=slot); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Respond to an invite request by sending a world invite to the requesting user. `:notificationId` is the ID of the requesting notification. -pub fn respond_invite(configuration: &configuration::Configuration, notification_id: &str, invite_response: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/invite/{notificationId}/response", local_var_configuration.base_path, notificationId=crate::apis::urlencode(notification_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(&invite_response); - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn respond_invite(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, notification_id: &str, invite_response: crate::models::InviteResponse) -> Result> { + let local_var_uri_str = format!("{}/invite/{notificationId}/response", configuration.base_path, notificationId=crate::apis::urlencode(notification_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, Some(invite_response)).await } /// Updates a single Invite Message and then returns a list of all of them. Admin Credentials are required to update messages of other users! Updating a message automatically sets the cooldown timer to 60 minutes. Trying to edit a message before the cooldown timer expires results in a 429 \"Too Fast Error\". Message type refers to a different collection of messages, used during different types of responses. * `message` = Message during a normal invite * `response` = Message when replying to a message * `request` = Message when requesting an invite * `requestResponse` = Message when replying to a request for invite -pub fn update_invite_message(configuration: &configuration::Configuration, user_id: &str, message_type: crate::models::InviteMessageType, slot: i32, update_invite_message_request: Option) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/message/{userId}/{messageType}/{slot}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id), messageType=message_type, slot=slot); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(&update_invite_message_request); - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn update_invite_message(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, user_id: &str, message_type: crate::models::InviteMessageType, slot: i32, update_invite_message_request: Option) -> Result, Error> { + let local_var_uri_str = format!("{}/message/{userId}/{messageType}/{slot}", configuration.base_path, userId=crate::apis::urlencode(user_id), messageType=message_type, slot=slot); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, Some(update_invite_message_request)).await } diff --git a/src/apis/notifications_api.rs b/src/apis/notifications_api.rs index 9d82774..41e633a 100644 --- a/src/apis/notifications_api.rs +++ b/src/apis/notifications_api.rs @@ -9,7 +9,7 @@ use reqwest; -use crate::apis::ResponseContent; +#[allow(unused_imports)] use crate::apis::ResponseContent; use super::{Error, configuration}; @@ -56,97 +56,30 @@ pub enum MarkNotificationAsReadError { /// Accept a friend request by notification `frq_` ID. Friend requests can be found using the NotificationsAPI `getNotifications` by filtering of type `friendRequest`. -pub fn accept_friend_request(configuration: &configuration::Configuration, notification_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/auth/user/notifications/{notificationId}/accept", local_var_configuration.base_path, notificationId=crate::apis::urlencode(notification_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn accept_friend_request(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, notification_id: &str) -> Result> { + let local_var_uri_str = format!("{}/auth/user/notifications/{notificationId}/accept", configuration.base_path, notificationId=crate::apis::urlencode(notification_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Clear **all** notifications. -pub fn clear_notifications(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/auth/user/notifications/clear", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn clear_notifications(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, ) -> Result> { + let local_var_uri_str = format!("{}/auth/user/notifications/clear", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Delete a notification. -pub fn delete_notification(configuration: &configuration::Configuration, notification_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/auth/user/notifications/{notificationId}/hide", local_var_configuration.base_path, notificationId=crate::apis::urlencode(notification_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn delete_notification(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, notification_id: &str) -> Result> { + let local_var_uri_str = format!("{}/auth/user/notifications/{notificationId}/hide", configuration.base_path, notificationId=crate::apis::urlencode(notification_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Retrieve all of the current user's notifications. -pub fn get_notifications(configuration: &configuration::Configuration, r#type: Option<&str>, sent: Option, hidden: Option, after: Option<&str>, n: Option, offset: Option) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/auth/user/notifications", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); +pub async fn get_notifications(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, r#type: Option<&str>, sent: Option, hidden: Option, after: Option<&str>, n: Option, offset: Option) -> Result, Error> { + let local_var_uri_str = format!("{}/auth/user/notifications", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = r#type { local_var_req_builder = local_var_req_builder.query(&[("type", &local_var_str.to_string())]); @@ -166,50 +99,13 @@ pub fn get_notifications(configuration: &configuration::Configuration, r#type: O if let Some(ref local_var_str) = offset { local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Mark a notification as seen. -pub fn mark_notification_as_read(configuration: &configuration::Configuration, notification_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/auth/user/notifications/{notificationId}/see", local_var_configuration.base_path, notificationId=crate::apis::urlencode(notification_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn mark_notification_as_read(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, notification_id: &str) -> Result> { + let local_var_uri_str = format!("{}/auth/user/notifications/{notificationId}/see", configuration.base_path, notificationId=crate::apis::urlencode(notification_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } diff --git a/src/apis/permissions_api.rs b/src/apis/permissions_api.rs index 4ad5c41..7baf064 100644 --- a/src/apis/permissions_api.rs +++ b/src/apis/permissions_api.rs @@ -9,7 +9,7 @@ use reqwest; -use crate::apis::ResponseContent; +#[allow(unused_imports)] use crate::apis::ResponseContent; use super::{Error, configuration}; @@ -31,58 +31,16 @@ pub enum GetPermissionError { /// Returns a list of all permissions currently granted by the user. Permissions are assigned e.g. by subscribing to VRC+. -pub fn get_assigned_permissions(configuration: &configuration::Configuration, ) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/auth/permissions", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_assigned_permissions(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, ) -> Result, Error> { + let local_var_uri_str = format!("{}/auth/permissions", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Returns a single permission. This endpoint is pretty useless, as it returns the exact same information as `/auth/permissions`. -pub fn get_permission(configuration: &configuration::Configuration, permission_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/permissions/{permissionId}", local_var_configuration.base_path, permissionId=crate::apis::urlencode(permission_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_permission(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, permission_id: &str) -> Result> { + let local_var_uri_str = format!("{}/permissions/{permissionId}", configuration.base_path, permissionId=crate::apis::urlencode(permission_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } diff --git a/src/apis/playermoderation_api.rs b/src/apis/playermoderation_api.rs index 6af6404..8debb19 100644 --- a/src/apis/playermoderation_api.rs +++ b/src/apis/playermoderation_api.rs @@ -9,7 +9,7 @@ use reqwest; -use crate::apis::ResponseContent; +#[allow(unused_imports)] use crate::apis::ResponseContent; use super::{Error, configuration}; @@ -65,97 +65,30 @@ pub enum UnmoderateUserError { /// ⚠️ **This will delete every single player moderation you've ever made.** -pub fn clear_all_player_moderations(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/auth/user/playermoderations", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn clear_all_player_moderations(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, ) -> Result> { + let local_var_uri_str = format!("{}/auth/user/playermoderations", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Deletes a specific player moderation based on it's `pmod_` ID. The website uses `unmoderateUser` instead. You can delete the same player moderation multiple times successfully. -pub fn delete_player_moderation(configuration: &configuration::Configuration, player_moderation_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/auth/user/playermoderations/{playerModerationId}", local_var_configuration.base_path, playerModerationId=crate::apis::urlencode(player_moderation_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn delete_player_moderation(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, player_moderation_id: &str) -> Result> { + let local_var_uri_str = format!("{}/auth/user/playermoderations/{playerModerationId}", configuration.base_path, playerModerationId=crate::apis::urlencode(player_moderation_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Returns a single Player Moderation. This returns the exact same amount of information as the more generalised `getPlayerModerations`. -pub fn get_player_moderation(configuration: &configuration::Configuration, player_moderation_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/auth/user/playermoderations/{playerModerationId}", local_var_configuration.base_path, playerModerationId=crate::apis::urlencode(player_moderation_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_player_moderation(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, player_moderation_id: &str) -> Result> { + let local_var_uri_str = format!("{}/auth/user/playermoderations/{playerModerationId}", configuration.base_path, playerModerationId=crate::apis::urlencode(player_moderation_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Returns a list of all player moderations made by **you**. This endpoint does not have pagination, and will return *all* results. Use query parameters to limit your query if needed. -pub fn get_player_moderations(configuration: &configuration::Configuration, r#type: Option<&str>, target_user_id: Option<&str>) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/auth/user/playermoderations", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); +pub async fn get_player_moderations(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, r#type: Option<&str>, target_user_id: Option<&str>) -> Result, Error> { + let local_var_uri_str = format!("{}/auth/user/playermoderations", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = r#type { local_var_req_builder = local_var_req_builder.query(&[("type", &local_var_str.to_string())]); @@ -163,80 +96,20 @@ pub fn get_player_moderations(configuration: &configuration::Configuration, r#ty if let Some(ref local_var_str) = target_user_id { local_var_req_builder = local_var_req_builder.query(&[("targetUserId", &local_var_str.to_string())]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Moderate a user, e.g. unmute them or show their avatar. Please see the [Player Moderation docs](https://vrchatapi.github.io/docs/api/#tag--playermoderation) on what playerModerations are, and how they differ from staff moderations. -pub fn moderate_user(configuration: &configuration::Configuration, moderate_user_request: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/auth/user/playermoderations", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(&moderate_user_request); - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn moderate_user(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, moderate_user_request: crate::models::ModerateUserRequest) -> Result> { + let local_var_uri_str = format!("{}/auth/user/playermoderations", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, Some(moderate_user_request)).await } /// Removes a player moderation previously added through `moderateUser`. E.g if you previously have shown their avatar, but now want to reset it to default. -pub fn unmoderate_user(configuration: &configuration::Configuration, moderate_user_request: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/auth/user/unplayermoderate", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(&moderate_user_request); - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn unmoderate_user(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, moderate_user_request: crate::models::ModerateUserRequest) -> Result> { + let local_var_uri_str = format!("{}/auth/user/unplayermoderate", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, Some(moderate_user_request)).await } diff --git a/src/apis/system_api.rs b/src/apis/system_api.rs index d95581f..220e052 100644 --- a/src/apis/system_api.rs +++ b/src/apis/system_api.rs @@ -9,7 +9,7 @@ use reqwest; -use crate::apis::ResponseContent; +#[allow(unused_imports)] use crate::apis::ResponseContent; use super::{Error, configuration}; @@ -66,41 +66,16 @@ pub enum GetSystemTimeError { /// API config contains configuration that the clients needs to work properly. Currently the most important value here is `clientApiKey` which is used for all other API endpoints. -pub fn get_config(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/config", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_config(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, ) -> Result> { + let local_var_uri_str = format!("{}/config", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Fetches the CSS code to the frontend React website. -pub fn get_css(configuration: &configuration::Configuration, variant: Option<&str>, branch: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/css/app.css", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); +pub async fn get_css(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, variant: Option<&str>, branch: Option<&str>) -> Result> { + let local_var_uri_str = format!("{}/css/app.css", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = variant { local_var_req_builder = local_var_req_builder.query(&[("variant", &local_var_str.to_string())]); @@ -108,89 +83,27 @@ pub fn get_css(configuration: &configuration::Configuration, variant: Option<&st if let Some(ref local_var_str) = branch { local_var_req_builder = local_var_req_builder.query(&[("branch", &local_var_str.to_string())]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Returns the current number of online users. **NOTE:** The response type is not a JSON object, but a simple JSON integer. -pub fn get_current_online_users(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/visits", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_current_online_users(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, ) -> Result> { + let local_var_uri_str = format!("{}/visits", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// ~~Gets the overall health status, the server name, and the current build version tag of the API.~~ **DEPRECATED:** VRChat has suddenly restricted this endpoint for unknown reasons, and now always return 401 Unauthorized. -pub fn get_health(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/health", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_health(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, ) -> Result> { + let local_var_uri_str = format!("{}/health", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// IPS (Info Push System) is a system for VRChat to push out dynamic information to the client. This is primarily used by the Quick-Menu info banners, but can also be used to e.g. alert you to update your game to the latest version. `include` is used to query what Information Pushes should be included in the response. If include is missing or empty, then no notices will normally be returned. This is an \"any of\" search. `require` is used to limit what Information Pushes should be included in the response. This is usually used in combination with `include`, and is an \"all of\" search. -pub fn get_info_push(configuration: &configuration::Configuration, require: Option<&str>, include: Option<&str>) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/infoPush", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); +pub async fn get_info_push(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, require: Option<&str>, include: Option<&str>) -> Result, Error> { + let local_var_uri_str = format!("{}/infoPush", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = require { local_var_req_builder = local_var_req_builder.query(&[("require", &local_var_str.to_string())]); @@ -198,33 +111,13 @@ pub fn get_info_push(configuration: &configuration::Configuration, require: Opti if let Some(ref local_var_str) = include { local_var_req_builder = local_var_req_builder.query(&[("include", &local_var_str.to_string())]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Fetches the JavaScript code to the frontend React website. -pub fn get_java_script(configuration: &configuration::Configuration, variant: Option<&str>, branch: Option<&str>) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/js/app.js", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); +pub async fn get_java_script(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, variant: Option<&str>, branch: Option<&str>) -> Result> { + let local_var_uri_str = format!("{}/js/app.js", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = variant { local_var_req_builder = local_var_req_builder.query(&[("variant", &local_var_str.to_string())]); @@ -232,50 +125,13 @@ pub fn get_java_script(configuration: &configuration::Configuration, variant: Op if let Some(ref local_var_str) = branch { local_var_req_builder = local_var_req_builder.query(&[("branch", &local_var_str.to_string())]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Returns the current time of the API server. **NOTE:** The response type is not a JSON object, but a simple JSON string. -pub fn get_system_time(configuration: &configuration::Configuration, ) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/time", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_system_time(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, ) -> Result> { + let local_var_uri_str = format!("{}/time", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } diff --git a/src/apis/users_api.rs b/src/apis/users_api.rs index d8f403a..00e3c32 100644 --- a/src/apis/users_api.rs +++ b/src/apis/users_api.rs @@ -9,7 +9,7 @@ use reqwest; -use crate::apis::ResponseContent; +#[allow(unused_imports)] use crate::apis::ResponseContent; use super::{Error, configuration}; @@ -45,6 +45,14 @@ pub enum GetUserGroupsError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`get_user_represented_group`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetUserRepresentedGroupError { + Status401(crate::models::Error), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`search_users`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -64,125 +72,44 @@ pub enum UpdateUserError { /// Get public user information about a specific user using their ID. -pub fn get_user(configuration: &configuration::Configuration, user_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/users/{userId}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_user(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, user_id: &str) -> Result> { + let local_var_uri_str = format!("{}/users/{userId}", configuration.base_path, userId=crate::apis::urlencode(user_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// ~~Get public user information about a specific user using their name.~~ **DEPRECATED:** VRChat API no longer return usernames of other users. [See issue by Tupper for more information](https://github.com/pypy-vrc/VRCX/issues/429). This endpoint now require Admin Credentials. -pub fn get_user_by_name(configuration: &configuration::Configuration, username: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/users/{username}/name", local_var_configuration.base_path, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_user_by_name(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, username: &str) -> Result> { + let local_var_uri_str = format!("{}/users/{username}/name", configuration.base_path, username=crate::apis::urlencode(username)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Returns a list of Groups the user has requested to be invited into. -pub fn get_user_group_requests(configuration: &configuration::Configuration, user_id: &str) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/users/{userId}/groups/requested", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_user_group_requests(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, user_id: &str) -> Result, Error> { + let local_var_uri_str = format!("{}/users/{userId}/groups/requested", configuration.base_path, userId=crate::apis::urlencode(user_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Get user's public groups -pub fn get_user_groups(configuration: &configuration::Configuration, user_id: &str) -> Result, Error> { - let local_var_configuration = configuration; +pub async fn get_user_groups(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, user_id: &str) -> Result, Error> { + let local_var_uri_str = format!("{}/users/{userId}/groups", configuration.base_path, userId=crate::apis::urlencode(user_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await +} - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/users/{userId}/groups", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +/// Returns the current group that the user is currently representing +pub async fn get_user_represented_group(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, user_id: &str) -> Result> { + let local_var_uri_str = format!("{}/users/{userId}/groups/represented", configuration.base_path, userId=crate::apis::urlencode(user_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Search and list any users by text query -pub fn search_users(configuration: &configuration::Configuration, search: Option<&str>, developer_type: Option<&str>, n: Option, offset: Option) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/users", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); +pub async fn search_users(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, search: Option<&str>, developer_type: Option<&str>, n: Option, offset: Option) -> Result, Error> { + let local_var_uri_str = format!("{}/users", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = search { local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]); @@ -196,51 +123,13 @@ pub fn search_users(configuration: &configuration::Configuration, search: Option if let Some(ref local_var_str) = offset { local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Update a users information such as the email and birthday. -pub fn update_user(configuration: &configuration::Configuration, user_id: &str, update_user_request: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/users/{userId}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(&update_user_request); - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn update_user(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, user_id: &str, update_user_request: Option) -> Result> { + let local_var_uri_str = format!("{}/users/{userId}", configuration.base_path, userId=crate::apis::urlencode(user_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, Some(update_user_request)).await } diff --git a/src/apis/worlds_api.rs b/src/apis/worlds_api.rs index 9cecd8c..7179d51 100644 --- a/src/apis/worlds_api.rs +++ b/src/apis/worlds_api.rs @@ -9,7 +9,7 @@ use reqwest; -use crate::apis::ResponseContent; +#[allow(unused_imports)] use crate::apis::ResponseContent; use super::{Error, configuration}; @@ -127,70 +127,23 @@ pub enum UpdateWorldError { /// Create a new world. This endpoint requires `assetUrl` to be a valid File object with `.vrcw` file extension, and `imageUrl` to be a valid File object with an image file extension. -pub fn create_world(configuration: &configuration::Configuration, create_world_request: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/worlds", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(&create_world_request); - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn create_world(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, create_world_request: Option) -> Result> { + let local_var_uri_str = format!("{}/worlds", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, Some(create_world_request)).await } /// Delete a world. Notice a world is never fully \"deleted\", only its ReleaseStatus is set to \"hidden\" and the linked Files are deleted. The WorldID is permanently reserved. -pub fn delete_world(configuration: &configuration::Configuration, world_id: &str) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/worlds/{worldId}", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn delete_world(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, world_id: &str) -> Result<(), Error> { + let local_var_uri_str = format!("{}/worlds/{worldId}", configuration.base_path, worldId=crate::apis::urlencode(world_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + crate::request_ok(configuration, local_var_req_builder, None::<()>).await } /// Search and list currently Active worlds by query filters. -pub fn get_active_worlds(configuration: &configuration::Configuration, featured: Option, sort: Option, n: Option, order: Option, offset: Option, search: Option<&str>, tag: Option<&str>, notag: Option<&str>, release_status: Option, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/worlds/active", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); +pub async fn get_active_worlds(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, featured: Option, sort: Option, n: Option, order: Option, offset: Option, search: Option<&str>, tag: Option<&str>, notag: Option<&str>, release_status: Option, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>) -> Result, Error> { + let local_var_uri_str = format!("{}/worlds/active", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = featured { local_var_req_builder = local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); @@ -228,33 +181,13 @@ pub fn get_active_worlds(configuration: &configuration::Configuration, featured: if let Some(ref local_var_str) = platform { local_var_req_builder = local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Search and list favorited worlds by query filters. -pub fn get_favorited_worlds(configuration: &configuration::Configuration, featured: Option, sort: Option, n: Option, order: Option, offset: Option, search: Option<&str>, tag: Option<&str>, notag: Option<&str>, release_status: Option, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>, user_id: Option<&str>) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/worlds/favorites", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); +pub async fn get_favorited_worlds(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, featured: Option, sort: Option, n: Option, order: Option, offset: Option, search: Option<&str>, tag: Option<&str>, notag: Option<&str>, release_status: Option, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>, user_id: Option<&str>) -> Result, Error> { + let local_var_uri_str = format!("{}/worlds/favorites", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = featured { local_var_req_builder = local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); @@ -295,33 +228,13 @@ pub fn get_favorited_worlds(configuration: &configuration::Configuration, featur if let Some(ref local_var_str) = user_id { local_var_req_builder = local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Search and list recently visited worlds by query filters. -pub fn get_recent_worlds(configuration: &configuration::Configuration, featured: Option, sort: Option, n: Option, order: Option, offset: Option, search: Option<&str>, tag: Option<&str>, notag: Option<&str>, release_status: Option, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>, user_id: Option<&str>) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/worlds/recent", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); +pub async fn get_recent_worlds(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, featured: Option, sort: Option, n: Option, order: Option, offset: Option, search: Option<&str>, tag: Option<&str>, notag: Option<&str>, release_status: Option, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>, user_id: Option<&str>) -> Result, Error> { + let local_var_uri_str = format!("{}/worlds/recent", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = featured { local_var_req_builder = local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); @@ -362,173 +275,48 @@ pub fn get_recent_worlds(configuration: &configuration::Configuration, featured: if let Some(ref local_var_str) = user_id { local_var_req_builder = local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Get information about a specific World. Works unauthenticated but when so will always return `0` for certain fields. -pub fn get_world(configuration: &configuration::Configuration, world_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/worlds/{worldId}", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_world(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, world_id: &str) -> Result> { + let local_var_uri_str = format!("{}/worlds/{worldId}", configuration.base_path, worldId=crate::apis::urlencode(world_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Returns a worlds instance. -pub fn get_world_instance(configuration: &configuration::Configuration, world_id: &str, instance_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/worlds/{worldId}/{instanceId}", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_world_instance(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, world_id: &str, instance_id: &str) -> Result> { + let local_var_uri_str = format!("{}/worlds/{worldId}/{instanceId}", configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Return a worlds custom metadata. This is currently believed to be unused. Metadata can be set with `updateWorld` and can be any arbitrary object. -pub fn get_world_metadata(configuration: &configuration::Configuration, world_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/worlds/{worldId}/metadata", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_world_metadata(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, world_id: &str) -> Result> { + let local_var_uri_str = format!("{}/worlds/{worldId}/metadata", configuration.base_path, worldId=crate::apis::urlencode(world_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Returns a worlds publish status. -pub fn get_world_publish_status(configuration: &configuration::Configuration, world_id: &str) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/worlds/{worldId}/publish", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn get_world_publish_status(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, world_id: &str) -> Result> { + let local_var_uri_str = format!("{}/worlds/{worldId}/publish", configuration.base_path, worldId=crate::apis::urlencode(world_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Publish a world. You can only publish one world per week. -pub fn publish_world(configuration: &configuration::Configuration, world_id: &str) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/worlds/{worldId}/publish", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn publish_world(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, world_id: &str) -> Result<(), Error> { + let local_var_uri_str = format!("{}/worlds/{worldId}/publish", configuration.base_path, worldId=crate::apis::urlencode(world_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + crate::request_ok(configuration, local_var_req_builder, None::<()>).await } /// Search and list any worlds by query filters. -pub fn search_worlds(configuration: &configuration::Configuration, featured: Option, sort: Option, user: Option<&str>, user_id: Option<&str>, n: Option, order: Option, offset: Option, search: Option<&str>, tag: Option<&str>, notag: Option<&str>, release_status: Option, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>) -> Result, Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/worlds", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); +pub async fn search_worlds(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, featured: Option, sort: Option, user: Option<&str>, user_id: Option<&str>, n: Option, order: Option, offset: Option, search: Option<&str>, tag: Option<&str>, notag: Option<&str>, release_status: Option, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>) -> Result, Error> { + let local_var_uri_str = format!("{}/worlds", configuration.base_path); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = featured { local_var_req_builder = local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); @@ -572,79 +360,20 @@ pub fn search_worlds(configuration: &configuration::Configuration, featured: Opt if let Some(ref local_var_str) = platform { local_var_req_builder = local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); } - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } + crate::request(configuration, local_var_req_builder, None::<()>).await } /// Unpublish a world. -pub fn unpublish_world(configuration: &configuration::Configuration, world_id: &str) -> Result<(), Error> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/worlds/{worldId}/publish", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - Ok(()) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn unpublish_world(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, world_id: &str) -> Result<(), Error> { + let local_var_uri_str = format!("{}/worlds/{worldId}/publish", configuration.base_path, worldId=crate::apis::urlencode(world_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + crate::request_ok(configuration, local_var_req_builder, None::<()>).await } /// Update information about a specific World. -pub fn update_world(configuration: &configuration::Configuration, world_id: &str, update_world_request: Option) -> Result> { - let local_var_configuration = configuration; - - let local_var_client = &local_var_configuration.client; - - let local_var_uri_str = format!("{}/worlds/{worldId}", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); - - if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); - } - local_var_req_builder = local_var_req_builder.json(&update_world_request); - - let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; - - let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; - - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) - } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Err(Error::ResponseError(local_var_error)) - } +pub async fn update_world(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, world_id: &str, update_world_request: Option) -> Result> { + let local_var_uri_str = format!("{}/worlds/{worldId}", configuration.base_path, worldId=crate::apis::urlencode(world_id)); + #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + crate::request(configuration, local_var_req_builder, Some(update_world_request)).await } diff --git a/src/lib.rs b/src/lib.rs index c1dd666..e979df9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,3 +8,49 @@ extern crate reqwest; pub mod apis; pub mod models; +use serde::de::DeserializeOwned; +use reqwest::RequestBuilder; +use serde::Serialize; +use reqwest::StatusCode; +use crate::apis::{configuration, Error, ResponseContent}; + +async fn request( + configuration: &configuration::Configuration + Clone + core::fmt::Debug>, + request: RequestBuilder, + data: Option, +) -> Result> { + request_int(configuration, request, data, |_, content| serde_json::from_str(&content).map_err(Error::from)).await +} +async fn request_ok( + configuration: &configuration::Configuration + Clone + core::fmt::Debug>, + request: RequestBuilder, + data: Option, +) -> Result<(), Error> { + request_int(configuration, request, data, |_,_| Ok(())).await +} + +async fn request_int( + configuration: &configuration::Configuration + Clone + core::fmt::Debug>, + mut request: RequestBuilder, + data: Option, + output: impl FnOnce(StatusCode, String) -> Result> +) -> Result> { + if let Some(ref local_var_user_agent) = configuration.user_agent { + request = request.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(data) = data{ + request = request.json(&data); + } + + let resp = configuration.client.execute(request.build()?).await?; + let status = resp.status(); + let content = resp.text().await?; + + if !status.is_client_error() && !status.is_server_error() { + output(status, content) + } else { + let local_var_entity: Option = serde_json::from_str(&content).ok(); + let local_var_error = ResponseContent { status, content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} \ No newline at end of file diff --git a/src/models/add_favorite_request.rs b/src/models/add_favorite_request.rs index 5e7bf3d..3075752 100644 --- a/src/models/add_favorite_request.rs +++ b/src/models/add_favorite_request.rs @@ -18,11 +18,11 @@ pub struct AddFavoriteRequest { pub favorite_id: String, /// Tags indicate which group this favorite belongs to. Adding multiple groups makes it show up in all. Removing it from one in that case removes it from all. #[serde(rename = "tags")] - pub tags: Vec, + pub tags: Vec, } impl AddFavoriteRequest { - pub fn new(r#type: crate::models::FavoriteType, favorite_id: String, tags: Vec) -> AddFavoriteRequest { + pub fn new(r#type: crate::models::FavoriteType, favorite_id: String, tags: Vec) -> AddFavoriteRequest { AddFavoriteRequest { r#type, favorite_id, diff --git a/src/models/avatar.rs b/src/models/avatar.rs index d0c3aa3..511ed23 100644 --- a/src/models/avatar.rs +++ b/src/models/avatar.rs @@ -39,7 +39,7 @@ pub struct Avatar { pub release_status: crate::models::ReleaseStatus, /// #[serde(rename = "tags")] - pub tags: Vec, + pub tags: Vec, #[serde(rename = "thumbnailImageUrl")] pub thumbnail_image_url: String, #[serde(rename = "unityPackageUrl")] @@ -56,7 +56,7 @@ pub struct Avatar { impl Avatar { /// - pub fn new(author_id: String, author_name: String, created_at: String, description: String, featured: bool, id: String, image_url: String, name: String, release_status: crate::models::ReleaseStatus, tags: Vec, thumbnail_image_url: String, unity_package_url: String, unity_package_url_object: crate::models::AvatarUnityPackageUrlObject, unity_packages: Vec, updated_at: String, version: i32) -> Avatar { + pub fn new(author_id: String, author_name: String, created_at: String, description: String, featured: bool, id: String, image_url: String, name: String, release_status: crate::models::ReleaseStatus, tags: Vec, thumbnail_image_url: String, unity_package_url: String, unity_package_url_object: crate::models::AvatarUnityPackageUrlObject, unity_packages: Vec, updated_at: String, version: i32) -> Avatar { Avatar { asset_url: None, asset_url_object: None, diff --git a/src/models/badge.rs b/src/models/badge.rs new file mode 100644 index 0000000..aef5e26 --- /dev/null +++ b/src/models/badge.rs @@ -0,0 +1,51 @@ +/* + * VRChat API Documentation + * + * + * Contact: vrchatapi.lpv0t@aries.fyi + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct Badge { + /// only present in CurrentUser badges + #[serde(rename = "assignedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub assigned_at: Option>, + #[serde(rename = "badgeDescription")] + pub badge_description: String, + #[serde(rename = "badgeId")] + pub badge_id: String, + /// direct url to image + #[serde(rename = "badgeImageUrl")] + pub badge_image_url: String, + #[serde(rename = "badgeName")] + pub badge_name: String, + /// only present in CurrentUser badges + #[serde(rename = "hidden", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub hidden: Option>, + #[serde(rename = "showcased")] + pub showcased: bool, + /// only present in CurrentUser badges + #[serde(rename = "updatedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub updated_at: Option>, +} + +impl Badge { + pub fn new(badge_description: String, badge_id: String, badge_image_url: String, badge_name: String, showcased: bool) -> Badge { + Badge { + assigned_at: None, + badge_description, + badge_id, + badge_image_url, + badge_name, + hidden: None, + showcased, + updated_at: None, + } + } +} + + diff --git a/src/models/create_avatar_request.rs b/src/models/create_avatar_request.rs index 6289962..a346c1a 100644 --- a/src/models/create_avatar_request.rs +++ b/src/models/create_avatar_request.rs @@ -30,6 +30,8 @@ pub struct CreateAvatarRequest { pub version: Option, #[serde(rename = "unityPackageUrl", skip_serializing_if = "Option::is_none")] pub unity_package_url: Option, + #[serde(rename = "unityVersion", skip_serializing_if = "Option::is_none")] + pub unity_version: Option, } impl CreateAvatarRequest { @@ -44,6 +46,7 @@ impl CreateAvatarRequest { release_status: None, version: None, unity_package_url: None, + unity_version: None, } } } diff --git a/src/models/create_group_post_request.rs b/src/models/create_group_post_request.rs new file mode 100644 index 0000000..abc06df --- /dev/null +++ b/src/models/create_group_post_request.rs @@ -0,0 +1,45 @@ +/* + * VRChat API Documentation + * + * + * Contact: vrchatapi.lpv0t@aries.fyi + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct CreateGroupPostRequest { + /// Post title + #[serde(rename = "title")] + pub title: String, + /// Post text + #[serde(rename = "text")] + pub text: String, + #[serde(rename = "imageId", skip_serializing_if = "Option::is_none")] + pub image_id: Option, + /// Send notification to group members. + #[serde(rename = "sendNotification")] + pub send_notification: bool, + /// + #[serde(rename = "roleIds", skip_serializing_if = "Option::is_none")] + pub role_ids: Option>, + #[serde(rename = "visibility")] + pub visibility: crate::models::GroupPostVisibility, +} + +impl CreateGroupPostRequest { + pub fn new(title: String, text: String, send_notification: bool, visibility: crate::models::GroupPostVisibility) -> CreateGroupPostRequest { + CreateGroupPostRequest { + title, + text, + image_id: None, + send_notification, + role_ids: None, + visibility, + } + } +} + + diff --git a/src/models/create_instance_request.rs b/src/models/create_instance_request.rs new file mode 100644 index 0000000..84bb275 --- /dev/null +++ b/src/models/create_instance_request.rs @@ -0,0 +1,62 @@ +/* + * VRChat API Documentation + * + * + * Contact: vrchatapi.lpv0t@aries.fyi + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct CreateInstanceRequest { + /// WorldID be \"offline\" on User profiles if you are not friends with that user. + #[serde(rename = "worldId")] + pub world_id: String, + #[serde(rename = "type")] + pub r#type: crate::models::InstanceType, + #[serde(rename = "region")] + pub region: crate::models::InstanceRegion, + /// A groupId if the instance type is \"group\", null if instance type is public, or a userId otherwise + #[serde(rename = "ownerId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub owner_id: Option>, + /// Group roleIds that are allowed to join if the type is \"group\" and groupAccessType is \"member\" + #[serde(rename = "roleIds", skip_serializing_if = "Option::is_none")] + pub role_ids: Option>, + #[serde(rename = "groupAccessType", skip_serializing_if = "Option::is_none")] + pub group_access_type: Option, + #[serde(rename = "queueEnabled", skip_serializing_if = "Option::is_none")] + pub queue_enabled: Option, + /// The time after which users won't be allowed to join the instance. This doesn't work for public instances. + #[serde(rename = "closedAt", skip_serializing_if = "Option::is_none")] + pub closed_at: Option, + /// Only applies to invite type instances to make them invite+ + #[serde(rename = "canRequestInvite", skip_serializing_if = "Option::is_none")] + pub can_request_invite: Option, + /// Currently unused, but will eventually be a flag to set if the closing of the instance should kick people. + #[serde(rename = "hardClose", skip_serializing_if = "Option::is_none")] + pub hard_close: Option, + #[serde(rename = "inviteOnly", skip_serializing_if = "Option::is_none")] + pub invite_only: Option, +} + +impl CreateInstanceRequest { + pub fn new(world_id: String, r#type: crate::models::InstanceType, region: crate::models::InstanceRegion) -> CreateInstanceRequest { + CreateInstanceRequest { + world_id, + r#type, + region, + owner_id: None, + role_ids: None, + group_access_type: None, + queue_enabled: None, + closed_at: None, + can_request_invite: None, + hard_close: None, + invite_only: None, + } + } +} + + diff --git a/src/models/current_user.rs b/src/models/current_user.rs index 7b042b0..bfc0eda 100644 --- a/src/models/current_user.rs +++ b/src/models/current_user.rs @@ -25,6 +25,9 @@ pub struct CurrentUser { pub active_friends: Option>, #[serde(rename = "allowAvatarCopying")] pub allow_avatar_copying: bool, + /// + #[serde(rename = "badges", skip_serializing_if = "Option::is_none")] + pub badges: Option>, #[serde(rename = "bio")] pub bio: String, /// @@ -40,6 +43,8 @@ pub struct CurrentUser { /// When profilePicOverride is not empty, use it instead. #[serde(rename = "currentAvatarThumbnailImageUrl")] pub current_avatar_thumbnail_image_url: String, + #[serde(rename = "currentAvatarTags")] + pub current_avatar_tags: Vec, #[serde(rename = "date_joined")] pub date_joined: String, #[serde(rename = "developerType")] @@ -59,6 +64,12 @@ pub struct CurrentUser { pub friends: Vec, #[serde(rename = "hasBirthday")] pub has_birthday: bool, + #[serde(rename = "hideContentFilterSettings", skip_serializing_if = "Option::is_none")] + pub hide_content_filter_settings: Option, + #[serde(rename = "userLanguage", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub user_language: Option>, + #[serde(rename = "userLanguageCode", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub user_language_code: Option>, #[serde(rename = "hasEmail")] pub has_email: bool, #[serde(rename = "hasLoggedInFromClient")] @@ -77,6 +88,8 @@ pub struct CurrentUser { pub last_activity: Option, #[serde(rename = "last_login")] pub last_login: String, + #[serde(rename = "last_mobile", deserialize_with = "Option::deserialize")] + pub last_mobile: Option, /// This can be `standalonewindows` or `android`, but can also pretty much be any random Unity verison such as `2019.2.4-801-Release` or `2019.2.2-772-Release` or even `unknownplatform`. #[serde(rename = "last_platform")] pub last_platform: String, @@ -86,6 +99,14 @@ pub struct CurrentUser { pub obfuscated_pending_email: String, #[serde(rename = "oculusId")] pub oculus_id: String, + #[serde(rename = "googleId", skip_serializing_if = "Option::is_none")] + pub google_id: Option, + #[serde(rename = "googleDetails", skip_serializing_if = "Option::is_none")] + pub google_details: Option, + #[serde(rename = "picoId", skip_serializing_if = "Option::is_none")] + pub pico_id: Option, + #[serde(rename = "viveId", skip_serializing_if = "Option::is_none")] + pub vive_id: Option, #[serde(rename = "offlineFriends", skip_serializing_if = "Option::is_none")] pub offline_friends: Option>, #[serde(rename = "onlineFriends", skip_serializing_if = "Option::is_none")] @@ -97,6 +118,8 @@ pub struct CurrentUser { pub presence: Option>, #[serde(rename = "profilePicOverride")] pub profile_pic_override: String, + #[serde(rename = "pronouns")] + pub pronouns: String, #[serde(rename = "state")] pub state: crate::models::UserState, #[serde(rename = "status")] @@ -112,7 +135,7 @@ pub struct CurrentUser { #[serde(rename = "steamId")] pub steam_id: String, #[serde(rename = "tags")] - pub tags: Vec, + pub tags: Vec, #[serde(rename = "twoFactorAuthEnabled")] pub two_factor_auth_enabled: bool, #[serde(rename = "twoFactorAuthEnabledDate", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] @@ -129,7 +152,7 @@ pub struct CurrentUser { } impl CurrentUser { - pub fn new(accepted_tos_version: i32, allow_avatar_copying: bool, bio: String, bio_links: Vec, current_avatar: String, current_avatar_asset_url: String, current_avatar_image_url: String, current_avatar_thumbnail_image_url: String, date_joined: String, developer_type: crate::models::DeveloperType, display_name: String, email_verified: bool, friend_group_names: Vec, friend_key: String, friends: Vec, has_birthday: bool, has_email: bool, has_logged_in_from_client: bool, has_pending_email: bool, home_location: String, id: String, is_friend: bool, last_login: String, last_platform: String, obfuscated_email: String, obfuscated_pending_email: String, oculus_id: String, past_display_names: Vec, profile_pic_override: String, state: crate::models::UserState, status: crate::models::UserStatus, status_description: String, status_first_time: bool, status_history: Vec, steam_details: serde_json::Value, steam_id: String, tags: Vec, two_factor_auth_enabled: bool, unsubscribe: bool, user_icon: String) -> CurrentUser { + pub fn new(accepted_tos_version: i32, allow_avatar_copying: bool, bio: String, bio_links: Vec, current_avatar: String, current_avatar_asset_url: String, current_avatar_image_url: String, current_avatar_thumbnail_image_url: String, current_avatar_tags: Vec, date_joined: String, developer_type: crate::models::DeveloperType, display_name: String, email_verified: bool, friend_group_names: Vec, friend_key: String, friends: Vec, has_birthday: bool, has_email: bool, has_logged_in_from_client: bool, has_pending_email: bool, home_location: String, id: String, is_friend: bool, last_login: String, last_mobile: Option, last_platform: String, obfuscated_email: String, obfuscated_pending_email: String, oculus_id: String, past_display_names: Vec, profile_pic_override: String, pronouns: String, state: crate::models::UserState, status: crate::models::UserStatus, status_description: String, status_first_time: bool, status_history: Vec, steam_details: serde_json::Value, steam_id: String, tags: Vec, two_factor_auth_enabled: bool, unsubscribe: bool, user_icon: String) -> CurrentUser { CurrentUser { accepted_tos_version, accepted_privacy_version: None, @@ -137,12 +160,14 @@ impl CurrentUser { account_deletion_log: None, active_friends: None, allow_avatar_copying, + badges: None, bio, bio_links, current_avatar, current_avatar_asset_url, current_avatar_image_url, current_avatar_thumbnail_image_url, + current_avatar_tags, date_joined, developer_type, display_name, @@ -152,6 +177,9 @@ impl CurrentUser { friend_key, friends, has_birthday, + hide_content_filter_settings: None, + user_language: None, + user_language_code: None, has_email, has_logged_in_from_client, has_pending_email, @@ -160,15 +188,21 @@ impl CurrentUser { is_friend, last_activity: None, last_login, + last_mobile, last_platform, obfuscated_email, obfuscated_pending_email, oculus_id, + google_id: None, + google_details: None, + pico_id: None, + vive_id: None, offline_friends: None, online_friends: None, past_display_names, presence: None, profile_pic_override, + pronouns, state, status, status_description, @@ -188,3 +222,15 @@ impl CurrentUser { } +#[derive(Serialize, Deserialize)] +#[serde(untagged)] +pub enum EitherUserOrTwoFactor{ + CurrentUser(CurrentUser), + RequiresTwoFactorAuth(RequiresTwoFactorAuth), +} + +#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize)] +pub struct RequiresTwoFactorAuth{ + #[serde(rename = "requiresTwoFactorAuth")] + pub requires_two_factor_auth: Vec +} \ No newline at end of file diff --git a/src/models/favorite.rs b/src/models/favorite.rs index ad2fbe6..cfb25ce 100644 --- a/src/models/favorite.rs +++ b/src/models/favorite.rs @@ -19,14 +19,14 @@ pub struct Favorite { pub id: String, /// #[serde(rename = "tags")] - pub tags: Vec, + pub tags: Vec, #[serde(rename = "type")] pub r#type: crate::models::FavoriteType, } impl Favorite { /// - pub fn new(favorite_id: String, id: String, tags: Vec, r#type: crate::models::FavoriteType) -> Favorite { + pub fn new(favorite_id: String, id: String, tags: Vec, r#type: crate::models::FavoriteType) -> Favorite { Favorite { favorite_id, id, diff --git a/src/models/favorite_group.rs b/src/models/favorite_group.rs index b962f4b..40e73f9 100644 --- a/src/models/favorite_group.rs +++ b/src/models/favorite_group.rs @@ -25,7 +25,7 @@ pub struct FavoriteGroup { pub owner_id: String, /// #[serde(rename = "tags")] - pub tags: Vec, + pub tags: Vec, #[serde(rename = "type")] pub r#type: crate::models::FavoriteType, #[serde(rename = "visibility")] @@ -34,7 +34,7 @@ pub struct FavoriteGroup { impl FavoriteGroup { /// - pub fn new(display_name: String, id: String, name: String, owner_display_name: String, owner_id: String, tags: Vec, r#type: crate::models::FavoriteType, visibility: crate::models::FavoriteGroupVisibility) -> FavoriteGroup { + pub fn new(display_name: String, id: String, name: String, owner_display_name: String, owner_id: String, tags: Vec, r#type: crate::models::FavoriteType, visibility: crate::models::FavoriteGroupVisibility) -> FavoriteGroup { FavoriteGroup { display_name, id, diff --git a/src/models/file.rs b/src/models/file.rs index 04b4247..df369cc 100644 --- a/src/models/file.rs +++ b/src/models/file.rs @@ -26,7 +26,7 @@ pub struct File { pub owner_id: String, /// #[serde(rename = "tags")] - pub tags: Vec, + pub tags: Vec, /// #[serde(rename = "versions")] pub versions: Vec, @@ -34,7 +34,7 @@ pub struct File { impl File { /// - pub fn new(extension: String, id: String, mime_type: crate::models::MimeType, name: String, owner_id: String, tags: Vec, versions: Vec) -> File { + pub fn new(extension: String, id: String, mime_type: crate::models::MimeType, name: String, owner_id: String, tags: Vec, versions: Vec) -> File { File { extension, id, diff --git a/src/models/group_access_type.rs b/src/models/group_access_type.rs new file mode 100644 index 0000000..0e6d1ec --- /dev/null +++ b/src/models/group_access_type.rs @@ -0,0 +1,41 @@ +/* + * VRChat API Documentation + * + * + * Contact: vrchatapi.lpv0t@aries.fyi + * Generated by: https://openapi-generator.tech + */ + +/// GroupAccessType : Group access type when the instance type is \"group\" + +/// Group access type when the instance type is \"group\" +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum GroupAccessType { + #[serde(rename = "public")] + Public, + #[serde(rename = "plus")] + Plus, + #[serde(rename = "members")] + Members, + +} + +impl ToString for GroupAccessType { + fn to_string(&self) -> String { + match self { + Self::Public => String::from("public"), + Self::Plus => String::from("plus"), + Self::Members => String::from("members"), + } + } +} + +impl Default for GroupAccessType { + fn default() -> GroupAccessType { + Self::Public + } +} + + + + diff --git a/src/models/group_audit_log_entry.rs b/src/models/group_audit_log_entry.rs index fe51f54..b98952b 100644 --- a/src/models/group_audit_log_entry.rs +++ b/src/models/group_audit_log_entry.rs @@ -20,8 +20,8 @@ pub struct GroupAuditLogEntry { /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. #[serde(rename = "actorId", skip_serializing_if = "Option::is_none")] pub actor_id: Option, - #[serde(rename = "actorDisplayname", skip_serializing_if = "Option::is_none")] - pub actor_displayname: Option, + #[serde(rename = "actorDisplayName", skip_serializing_if = "Option::is_none")] + pub actor_display_name: Option, /// Typically GroupID or GroupRoleID, but could be other types of IDs. #[serde(rename = "targetId", skip_serializing_if = "Option::is_none")] pub target_id: Option, @@ -43,7 +43,7 @@ impl GroupAuditLogEntry { created_at: None, group_id: None, actor_id: None, - actor_displayname: None, + actor_display_name: None, target_id: None, event_type: None, description: None, diff --git a/src/models/group_instance.rs b/src/models/group_instance.rs new file mode 100644 index 0000000..db09193 --- /dev/null +++ b/src/models/group_instance.rs @@ -0,0 +1,36 @@ +/* + * VRChat API Documentation + * + * + * Contact: vrchatapi.lpv0t@aries.fyi + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct GroupInstance { + #[serde(rename = "instanceId")] + pub instance_id: String, + /// InstanceID can be \"offline\" on User profiles if you are not friends with that user and \"private\" if you are friends and user is in private instance. + #[serde(rename = "location")] + pub location: String, + #[serde(rename = "world")] + pub world: Box, + #[serde(rename = "memberCount")] + pub member_count: i32, +} + +impl GroupInstance { + pub fn new(instance_id: String, location: String, world: crate::models::World, member_count: i32) -> GroupInstance { + GroupInstance { + instance_id, + location, + world: Box::new(world), + member_count, + } + } +} + + diff --git a/src/models/group_join_request_action.rs b/src/models/group_join_request_action.rs new file mode 100644 index 0000000..fd953ae --- /dev/null +++ b/src/models/group_join_request_action.rs @@ -0,0 +1,37 @@ +/* + * VRChat API Documentation + * + * + * Contact: vrchatapi.lpv0t@aries.fyi + * Generated by: https://openapi-generator.tech + */ + + +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum GroupJoinRequestAction { + #[serde(rename = "accept")] + Accept, + #[serde(rename = "reject")] + Reject, + +} + +impl ToString for GroupJoinRequestAction { + fn to_string(&self) -> String { + match self { + Self::Accept => String::from("accept"), + Self::Reject => String::from("reject"), + } + } +} + +impl Default for GroupJoinRequestAction { + fn default() -> GroupJoinRequestAction { + Self::Accept + } +} + + + + diff --git a/src/models/group_limited_member.rs b/src/models/group_limited_member.rs index 12a05eb..69a2a8e 100644 --- a/src/models/group_limited_member.rs +++ b/src/models/group_limited_member.rs @@ -18,8 +18,34 @@ pub struct GroupLimitedMember { /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. #[serde(rename = "userId", skip_serializing_if = "Option::is_none")] pub user_id: Option, + /// Whether the user is representing the group. This makes the group show up above the name tag in-game. #[serde(rename = "isRepresenting", skip_serializing_if = "Option::is_none")] pub is_representing: Option, + #[serde(rename = "roleIds", skip_serializing_if = "Option::is_none")] + pub role_ids: Option>, + #[serde(rename = "mRoleIds", skip_serializing_if = "Option::is_none")] + pub m_role_ids: Option>, + #[serde(rename = "joinedAt", skip_serializing_if = "Option::is_none")] + pub joined_at: Option, + #[serde(rename = "membershipStatus", skip_serializing_if = "Option::is_none")] + pub membership_status: Option, + #[serde(rename = "visibility", skip_serializing_if = "Option::is_none")] + pub visibility: Option, + #[serde(rename = "isSubscribedToAnnouncements", skip_serializing_if = "Option::is_none")] + pub is_subscribed_to_announcements: Option, + /// Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user. + #[serde(rename = "createdAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub created_at: Option>, + /// Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user. + #[serde(rename = "bannedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub banned_at: Option>, + /// Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user. + #[serde(rename = "managerNotes", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub manager_notes: Option>, + #[serde(rename = "lastPostReadAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub last_post_read_at: Option>, + #[serde(rename = "hasJoinedFromPurchase", skip_serializing_if = "Option::is_none")] + pub has_joined_from_purchase: Option, } impl GroupLimitedMember { @@ -29,6 +55,17 @@ impl GroupLimitedMember { group_id: None, user_id: None, is_representing: None, + role_ids: None, + m_role_ids: None, + joined_at: None, + membership_status: None, + visibility: None, + is_subscribed_to_announcements: None, + created_at: None, + banned_at: None, + manager_notes: None, + last_post_read_at: None, + has_joined_from_purchase: None, } } } diff --git a/src/models/group_member.rs b/src/models/group_member.rs index 7f5053d..c470c7c 100644 --- a/src/models/group_member.rs +++ b/src/models/group_member.rs @@ -25,10 +25,12 @@ pub struct GroupMember { pub user: Option>, #[serde(rename = "roleIds", skip_serializing_if = "Option::is_none")] pub role_ids: Option>, - #[serde(rename = "joinedAt", skip_serializing_if = "Option::is_none")] - pub joined_at: Option, + #[serde(rename = "mRoleIds", skip_serializing_if = "Option::is_none")] + pub m_role_ids: Option>, + #[serde(rename = "joinedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub joined_at: Option>, #[serde(rename = "membershipStatus", skip_serializing_if = "Option::is_none")] - pub membership_status: Option, + pub membership_status: Option, #[serde(rename = "visibility", skip_serializing_if = "Option::is_none")] pub visibility: Option, #[serde(rename = "isSubscribedToAnnouncements", skip_serializing_if = "Option::is_none")] @@ -42,6 +44,10 @@ pub struct GroupMember { /// Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user. #[serde(rename = "managerNotes", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub manager_notes: Option>, + #[serde(rename = "lastPostReadAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub last_post_read_at: Option>, + #[serde(rename = "hasJoinedFromPurchase", skip_serializing_if = "Option::is_none")] + pub has_joined_from_purchase: Option, } impl GroupMember { @@ -53,6 +59,7 @@ impl GroupMember { is_representing: None, user: None, role_ids: None, + m_role_ids: None, joined_at: None, membership_status: None, visibility: None, @@ -60,6 +67,8 @@ impl GroupMember { created_at: None, banned_at: None, manager_notes: None, + last_post_read_at: None, + has_joined_from_purchase: None, } } } diff --git a/src/models/group_member_limited_user.rs b/src/models/group_member_limited_user.rs index e0359c7..2ddc70b 100644 --- a/src/models/group_member_limited_user.rs +++ b/src/models/group_member_limited_user.rs @@ -17,10 +17,16 @@ pub struct GroupMemberLimitedUser { pub id: Option, #[serde(rename = "displayName", skip_serializing_if = "Option::is_none")] pub display_name: Option, - #[serde(rename = "thumbnailUrl", skip_serializing_if = "Option::is_none")] - pub thumbnail_url: Option, + #[serde(rename = "thumbnailUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub thumbnail_url: Option>, #[serde(rename = "iconUrl", skip_serializing_if = "Option::is_none")] pub icon_url: Option, + #[serde(rename = "profilePicOverride", skip_serializing_if = "Option::is_none")] + pub profile_pic_override: Option, + #[serde(rename = "currentAvatarThumbnailImageUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub current_avatar_thumbnail_image_url: Option>, + #[serde(rename = "currentAvatarTags", skip_serializing_if = "Option::is_none")] + pub current_avatar_tags: Option>, } impl GroupMemberLimitedUser { @@ -31,6 +37,9 @@ impl GroupMemberLimitedUser { display_name: None, thumbnail_url: None, icon_url: None, + profile_pic_override: None, + current_avatar_thumbnail_image_url: None, + current_avatar_tags: None, } } } diff --git a/src/models/group_member_status.rs b/src/models/group_member_status.rs index 002eba1..eec3807 100644 --- a/src/models/group_member_status.rs +++ b/src/models/group_member_status.rs @@ -18,6 +18,8 @@ pub enum GroupMemberStatus { Requested, #[serde(rename = "invited")] Invited, + #[serde(rename = "banned")] + Banned, } @@ -28,6 +30,7 @@ impl ToString for GroupMemberStatus { Self::Member => String::from("member"), Self::Requested => String::from("requested"), Self::Invited => String::from("invited"), + Self::Banned => String::from("banned"), } } } diff --git a/src/models/group_post.rs b/src/models/group_post.rs new file mode 100644 index 0000000..6cd4a22 --- /dev/null +++ b/src/models/group_post.rs @@ -0,0 +1,62 @@ +/* + * VRChat API Documentation + * + * + * Contact: vrchatapi.lpv0t@aries.fyi + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct GroupPost { + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "groupId", skip_serializing_if = "Option::is_none")] + pub group_id: Option, + /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. + #[serde(rename = "authorId", skip_serializing_if = "Option::is_none")] + pub author_id: Option, + /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. + #[serde(rename = "editorId", skip_serializing_if = "Option::is_none")] + pub editor_id: Option, + #[serde(rename = "visibility", skip_serializing_if = "Option::is_none")] + pub visibility: Option, + /// + #[serde(rename = "roleId", skip_serializing_if = "Option::is_none")] + pub role_id: Option>, + #[serde(rename = "title", skip_serializing_if = "Option::is_none")] + pub title: Option, + #[serde(rename = "text", skip_serializing_if = "Option::is_none")] + pub text: Option, + #[serde(rename = "imageId", skip_serializing_if = "Option::is_none")] + pub image_id: Option, + #[serde(rename = "imageUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub image_url: Option>, + #[serde(rename = "createdAt", skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "updatedAt", skip_serializing_if = "Option::is_none")] + pub updated_at: Option, +} + +impl GroupPost { + pub fn new() -> GroupPost { + GroupPost { + id: None, + group_id: None, + author_id: None, + editor_id: None, + visibility: None, + role_id: None, + title: None, + text: None, + image_id: None, + image_url: None, + created_at: None, + updated_at: None, + } + } +} + + diff --git a/src/models/group_post_visibility.rs b/src/models/group_post_visibility.rs new file mode 100644 index 0000000..da7e3df --- /dev/null +++ b/src/models/group_post_visibility.rs @@ -0,0 +1,37 @@ +/* + * VRChat API Documentation + * + * + * Contact: vrchatapi.lpv0t@aries.fyi + * Generated by: https://openapi-generator.tech + */ + + +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum GroupPostVisibility { + #[serde(rename = "group")] + Group, + #[serde(rename = "public")] + Public, + +} + +impl ToString for GroupPostVisibility { + fn to_string(&self) -> String { + match self { + Self::Group => String::from("group"), + Self::Public => String::from("public"), + } + } +} + +impl Default for GroupPostVisibility { + fn default() -> GroupPostVisibility { + Self::Group + } +} + + + + diff --git a/src/models/group_search_sort.rs b/src/models/group_search_sort.rs new file mode 100644 index 0000000..2d492db --- /dev/null +++ b/src/models/group_search_sort.rs @@ -0,0 +1,37 @@ +/* + * VRChat API Documentation + * + * + * Contact: vrchatapi.lpv0t@aries.fyi + * Generated by: https://openapi-generator.tech + */ + + +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum GroupSearchSort { + #[serde(rename = "joinedAt:asc")] + Asc, + #[serde(rename = "joinedAt:desc")] + Desc, + +} + +impl ToString for GroupSearchSort { + fn to_string(&self) -> String { + match self { + Self::Asc => String::from("joinedAt:asc"), + Self::Desc => String::from("joinedAt:desc"), + } + } +} + +impl Default for GroupSearchSort { + fn default() -> GroupSearchSort { + Self::Asc + } +} + + + + diff --git a/src/models/info_push.rs b/src/models/info_push.rs index 627f0f5..1facf3a 100644 --- a/src/models/info_push.rs +++ b/src/models/info_push.rs @@ -22,7 +22,7 @@ pub struct InfoPush { pub priority: i32, /// #[serde(rename = "tags")] - pub tags: Vec, + pub tags: Vec, #[serde(rename = "data")] pub data: Box, /// Unknown usage, MD5 @@ -41,7 +41,7 @@ pub struct InfoPush { impl InfoPush { /// - pub fn new(id: String, is_enabled: bool, release_status: crate::models::ReleaseStatus, priority: i32, tags: Vec, data: crate::models::InfoPushData, hash: String, created_at: String, updated_at: String) -> InfoPush { + pub fn new(id: String, is_enabled: bool, release_status: crate::models::ReleaseStatus, priority: i32, tags: Vec, data: crate::models::InfoPushData, hash: String, created_at: String, updated_at: String) -> InfoPush { InfoPush { id, is_enabled, diff --git a/src/models/instance.rs b/src/models/instance.rs index 943f6eb..3d36446 100644 --- a/src/models/instance.rs +++ b/src/models/instance.rs @@ -35,9 +35,9 @@ pub struct Instance { pub n_users: i32, #[serde(rename = "name")] pub name: String, - /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. - #[serde(rename = "ownerId", skip_serializing_if = "Option::is_none")] - pub owner_id: Option, + /// A groupId if the instance type is \"group\", null if instance type is public, or a userId otherwise + #[serde(rename = "ownerId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub owner_id: Option>, #[serde(rename = "permanent")] pub permanent: bool, #[serde(rename = "photonRegion")] @@ -45,14 +45,14 @@ pub struct Instance { #[serde(rename = "platforms")] pub platforms: Box, #[serde(rename = "region")] - pub region: crate::models::Region, + pub region: crate::models::InstanceRegion, #[serde(rename = "secureName")] pub secure_name: String, - #[serde(rename = "shortName", skip_serializing_if = "Option::is_none")] - pub short_name: Option, + #[serde(rename = "shortName", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub short_name: Option>, /// The tags array on Instances usually contain the language tags of the people in the instance. #[serde(rename = "tags")] - pub tags: Vec, + pub tags: Vec, #[serde(rename = "type")] pub r#type: crate::models::InstanceType, /// WorldID be \"offline\" on User profiles if you are not friends with that user. @@ -67,11 +67,38 @@ pub struct Instance { /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. #[serde(rename = "private", skip_serializing_if = "Option::is_none")] pub private: Option, + #[serde(rename = "queueEnabled")] + pub queue_enabled: bool, + #[serde(rename = "queueSize")] + pub queue_size: i32, + #[serde(rename = "recommendedCapacity")] + pub recommended_capacity: i32, + #[serde(rename = "roleRestricted", skip_serializing_if = "Option::is_none")] + pub role_restricted: Option, + #[serde(rename = "strict")] + pub strict: bool, + #[serde(rename = "userCount")] + pub user_count: i32, + #[serde(rename = "world")] + pub world: Box, + /// The users field is present on instances created by the requesting user. + #[serde(rename = "users", skip_serializing_if = "Option::is_none")] + pub users: Option>, + #[serde(rename = "groupAccessType", skip_serializing_if = "Option::is_none")] + pub group_access_type: Option, + #[serde(rename = "hasCapacityForYou", skip_serializing_if = "Option::is_none")] + pub has_capacity_for_you: Option, + #[serde(rename = "nonce", skip_serializing_if = "Option::is_none")] + pub nonce: Option, + #[serde(rename = "closedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub closed_at: Option>, + #[serde(rename = "hardClose", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub hard_close: Option>, } impl Instance { /// * `hidden` field is only present if InstanceType is `hidden` aka \"Friends+\", and is instance creator. * `friends` field is only present if InstanceType is `friends` aka \"Friends\", and is instance creator. * `private` field is only present if InstanceType is `private` aka \"Invite\" or \"Invite+\", and is instance creator. - pub fn new(active: bool, can_request_invite: bool, capacity: i32, client_number: String, full: bool, id: String, instance_id: String, location: String, n_users: i32, name: String, permanent: bool, photon_region: crate::models::Region, platforms: crate::models::InstancePlatforms, region: crate::models::Region, secure_name: String, tags: Vec, r#type: crate::models::InstanceType, world_id: String) -> Instance { + pub fn new(active: bool, can_request_invite: bool, capacity: i32, client_number: String, full: bool, id: String, instance_id: String, location: String, n_users: i32, name: String, permanent: bool, photon_region: crate::models::Region, platforms: crate::models::InstancePlatforms, region: crate::models::InstanceRegion, secure_name: String, tags: Vec, r#type: crate::models::InstanceType, world_id: String, queue_enabled: bool, queue_size: i32, recommended_capacity: i32, strict: bool, user_count: i32, world: crate::models::World) -> Instance { Instance { active, can_request_invite, @@ -96,6 +123,19 @@ impl Instance { hidden: None, friends: None, private: None, + queue_enabled, + queue_size, + recommended_capacity, + role_restricted: None, + strict, + user_count, + world: Box::new(world), + users: None, + group_access_type: None, + has_capacity_for_you: None, + nonce: None, + closed_at: None, + hard_close: None, } } } diff --git a/src/models/instance_region.rs b/src/models/instance_region.rs new file mode 100644 index 0000000..2e6f53d --- /dev/null +++ b/src/models/instance_region.rs @@ -0,0 +1,44 @@ +/* + * VRChat API Documentation + * + * + * Contact: vrchatapi.lpv0t@aries.fyi + * Generated by: https://openapi-generator.tech + */ + +/// InstanceRegion : Instance region + +/// Instance region +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum InstanceRegion { + #[serde(rename = "us")] + Us, + #[serde(rename = "use")] + Use, + #[serde(rename = "eu")] + Eu, + #[serde(rename = "jp")] + Jp, + +} + +impl ToString for InstanceRegion { + fn to_string(&self) -> String { + match self { + Self::Us => String::from("us"), + Self::Use => String::from("use"), + Self::Eu => String::from("eu"), + Self::Jp => String::from("jp"), + } + } +} + +impl Default for InstanceRegion { + fn default() -> InstanceRegion { + Self::Us + } +} + + + + diff --git a/src/models/limited_group.rs b/src/models/limited_group.rs new file mode 100644 index 0000000..3044a86 --- /dev/null +++ b/src/models/limited_group.rs @@ -0,0 +1,77 @@ +/* + * VRChat API Documentation + * + * + * Contact: vrchatapi.lpv0t@aries.fyi + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct LimitedGroup { + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "shortCode", skip_serializing_if = "Option::is_none")] + pub short_code: Option, + #[serde(rename = "discriminator", skip_serializing_if = "Option::is_none")] + pub discriminator: Option, + #[serde(rename = "description", skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "iconUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub icon_url: Option>, + #[serde(rename = "bannerUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub banner_url: Option>, + /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. + #[serde(rename = "ownerId", skip_serializing_if = "Option::is_none")] + pub owner_id: Option, + #[serde(rename = "rules", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub rules: Option>, + #[serde(rename = "iconId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub icon_id: Option>, + #[serde(rename = "bannerId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub banner_id: Option>, + #[serde(rename = "memberCount", skip_serializing_if = "Option::is_none")] + pub member_count: Option, + /// + #[serde(rename = "tags", skip_serializing_if = "Option::is_none")] + pub tags: Option>, + #[serde(rename = "createdAt", skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "membershipStatus", skip_serializing_if = "Option::is_none")] + pub membership_status: Option, + #[serde(rename = "isSearchable", skip_serializing_if = "Option::is_none")] + pub is_searchable: Option, + /// + #[serde(rename = "galleries", skip_serializing_if = "Option::is_none")] + pub galleries: Option>, +} + +impl LimitedGroup { + pub fn new() -> LimitedGroup { + LimitedGroup { + id: None, + name: None, + short_code: None, + discriminator: None, + description: None, + icon_url: None, + banner_url: None, + owner_id: None, + rules: None, + icon_id: None, + banner_id: None, + member_count: None, + tags: None, + created_at: None, + membership_status: None, + is_searchable: None, + galleries: None, + } + } +} + + diff --git a/src/models/limited_user.rs b/src/models/limited_user.rs index bcb998a..32f991e 100644 --- a/src/models/limited_user.rs +++ b/src/models/limited_user.rs @@ -14,12 +14,17 @@ pub struct LimitedUser { #[serde(rename = "bio", skip_serializing_if = "Option::is_none")] pub bio: Option, + /// + #[serde(rename = "bioLinks", skip_serializing_if = "Option::is_none")] + pub bio_links: Option>, /// When profilePicOverride is not empty, use it instead. - #[serde(rename = "currentAvatarImageUrl")] - pub current_avatar_image_url: String, + #[serde(rename = "currentAvatarImageUrl", skip_serializing_if = "Option::is_none")] + pub current_avatar_image_url: Option, /// When profilePicOverride is not empty, use it instead. - #[serde(rename = "currentAvatarThumbnailImageUrl")] - pub current_avatar_thumbnail_image_url: String, + #[serde(rename = "currentAvatarThumbnailImageUrl", skip_serializing_if = "Option::is_none")] + pub current_avatar_thumbnail_image_url: Option, + #[serde(rename = "currentAvatarTags", skip_serializing_if = "Option::is_none")] + pub current_avatar_tags: Option>, #[serde(rename = "developerType")] pub developer_type: crate::models::DeveloperType, #[serde(rename = "displayName")] @@ -34,17 +39,19 @@ pub struct LimitedUser { /// This can be `standalonewindows` or `android`, but can also pretty much be any random Unity verison such as `2019.2.4-801-Release` or `2019.2.2-772-Release` or even `unknownplatform`. #[serde(rename = "last_platform")] pub last_platform: String, - #[serde(rename = "profilePicOverride")] - pub profile_pic_override: String, + #[serde(rename = "profilePicOverride", skip_serializing_if = "Option::is_none")] + pub profile_pic_override: Option, + #[serde(rename = "pronouns", skip_serializing_if = "Option::is_none")] + pub pronouns: Option, #[serde(rename = "status")] pub status: crate::models::UserStatus, #[serde(rename = "statusDescription")] pub status_description: String, /// <- Always empty. #[serde(rename = "tags")] - pub tags: Vec, - #[serde(rename = "userIcon")] - pub user_icon: String, + pub tags: Vec, + #[serde(rename = "userIcon", skip_serializing_if = "Option::is_none")] + pub user_icon: Option, /// -| **DEPRECATED:** VRChat API no longer return usernames of other users. [See issue by Tupper for more information](https://github.com/pypy-vrc/VRCX/issues/429). #[serde(rename = "username", skip_serializing_if = "Option::is_none")] pub username: Option, @@ -56,22 +63,25 @@ pub struct LimitedUser { impl LimitedUser { /// - pub fn new(current_avatar_image_url: String, current_avatar_thumbnail_image_url: String, developer_type: crate::models::DeveloperType, display_name: String, id: String, is_friend: bool, last_platform: String, profile_pic_override: String, status: crate::models::UserStatus, status_description: String, tags: Vec, user_icon: String) -> LimitedUser { + pub fn new(developer_type: crate::models::DeveloperType, display_name: String, id: String, is_friend: bool, last_platform: String, status: crate::models::UserStatus, status_description: String, tags: Vec) -> LimitedUser { LimitedUser { bio: None, - current_avatar_image_url, - current_avatar_thumbnail_image_url, + bio_links: None, + current_avatar_image_url: None, + current_avatar_thumbnail_image_url: None, + current_avatar_tags: None, developer_type, display_name, fallback_avatar: None, id, is_friend, last_platform, - profile_pic_override, + profile_pic_override: None, + pronouns: None, status, status_description, tags, - user_icon, + user_icon: None, username: None, location: None, friend_key: None, diff --git a/src/models/limited_user_groups.rs b/src/models/limited_user_groups.rs new file mode 100644 index 0000000..d185672 --- /dev/null +++ b/src/models/limited_user_groups.rs @@ -0,0 +1,78 @@ +/* + * VRChat API Documentation + * + * + * Contact: vrchatapi.lpv0t@aries.fyi + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct LimitedUserGroups { + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "shortCode", skip_serializing_if = "Option::is_none")] + pub short_code: Option, + #[serde(rename = "discriminator", skip_serializing_if = "Option::is_none")] + pub discriminator: Option, + #[serde(rename = "description", skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "iconId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub icon_id: Option>, + #[serde(rename = "iconUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub icon_url: Option>, + #[serde(rename = "bannerId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub banner_id: Option>, + #[serde(rename = "bannerUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub banner_url: Option>, + #[serde(rename = "privacy", skip_serializing_if = "Option::is_none")] + pub privacy: Option, + #[serde(rename = "lastPostCreatedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub last_post_created_at: Option>, + /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. + #[serde(rename = "ownerId", skip_serializing_if = "Option::is_none")] + pub owner_id: Option, + #[serde(rename = "memberCount", skip_serializing_if = "Option::is_none")] + pub member_count: Option, + #[serde(rename = "groupId", skip_serializing_if = "Option::is_none")] + pub group_id: Option, + #[serde(rename = "memberVisibility", skip_serializing_if = "Option::is_none")] + pub member_visibility: Option, + #[serde(rename = "isRepresenting", skip_serializing_if = "Option::is_none")] + pub is_representing: Option, + #[serde(rename = "mutualGroup", skip_serializing_if = "Option::is_none")] + pub mutual_group: Option, + #[serde(rename = "lastPostReadAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub last_post_read_at: Option>, +} + +impl LimitedUserGroups { + pub fn new() -> LimitedUserGroups { + LimitedUserGroups { + id: None, + name: None, + short_code: None, + discriminator: None, + description: None, + icon_id: None, + icon_url: None, + banner_id: None, + banner_url: None, + privacy: None, + last_post_created_at: None, + owner_id: None, + member_count: None, + group_id: None, + member_visibility: None, + is_representing: None, + mutual_group: None, + last_post_read_at: None, + } + } +} + + diff --git a/src/models/limited_world.rs b/src/models/limited_world.rs index 03dbbf2..99ea723 100644 --- a/src/models/limited_world.rs +++ b/src/models/limited_world.rs @@ -19,10 +19,14 @@ pub struct LimitedWorld { pub author_name: String, #[serde(rename = "capacity")] pub capacity: i32, + #[serde(rename = "recommendedCapacity", skip_serializing_if = "Option::is_none")] + pub recommended_capacity: Option, #[serde(rename = "created_at")] pub created_at: String, #[serde(rename = "favorites")] pub favorites: i32, + #[serde(rename = "visits", skip_serializing_if = "Option::is_none")] + pub visits: Option, #[serde(rename = "heat")] pub heat: i32, /// WorldID be \"offline\" on User profiles if you are not friends with that user. @@ -40,13 +44,15 @@ pub struct LimitedWorld { pub organization: String, #[serde(rename = "popularity")] pub popularity: i32, + #[serde(rename = "previewYoutubeId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub preview_youtube_id: Option>, #[serde(rename = "publicationDate")] pub publication_date: String, #[serde(rename = "releaseStatus")] pub release_status: crate::models::ReleaseStatus, /// #[serde(rename = "tags")] - pub tags: Vec, + pub tags: Vec, #[serde(rename = "thumbnailImageUrl")] pub thumbnail_image_url: String, /// @@ -54,17 +60,21 @@ pub struct LimitedWorld { pub unity_packages: Vec, #[serde(rename = "updated_at")] pub updated_at: String, + #[serde(rename = "udonProducts", skip_serializing_if = "Option::is_none")] + pub udon_products: Option>, } impl LimitedWorld { /// - pub fn new(author_id: String, author_name: String, capacity: i32, created_at: String, favorites: i32, heat: i32, id: String, image_url: String, labs_publication_date: String, name: String, occupants: i32, organization: String, popularity: i32, publication_date: String, release_status: crate::models::ReleaseStatus, tags: Vec, thumbnail_image_url: String, unity_packages: Vec, updated_at: String) -> LimitedWorld { + pub fn new(author_id: String, author_name: String, capacity: i32, created_at: String, favorites: i32, heat: i32, id: String, image_url: String, labs_publication_date: String, name: String, occupants: i32, organization: String, popularity: i32, publication_date: String, release_status: crate::models::ReleaseStatus, tags: Vec, thumbnail_image_url: String, unity_packages: Vec, updated_at: String) -> LimitedWorld { LimitedWorld { author_id, author_name, capacity, + recommended_capacity: None, created_at, favorites, + visits: None, heat, id, image_url, @@ -73,12 +83,14 @@ impl LimitedWorld { occupants, organization, popularity, + preview_youtube_id: None, publication_date, release_status, tags, thumbnail_image_url, unity_packages, updated_at, + udon_products: None, } } } diff --git a/src/models/mod.rs b/src/models/mod.rs index 1a36e83..489b472 100644 --- a/src/models/mod.rs +++ b/src/models/mod.rs @@ -18,6 +18,8 @@ pub mod avatar; pub use self::avatar::Avatar; pub mod avatar_unity_package_url_object; pub use self::avatar_unity_package_url_object::AvatarUnityPackageUrlObject; +pub mod badge; +pub use self::badge::Badge; pub mod ban_group_member_request; pub use self::ban_group_member_request::BanGroupMemberRequest; pub mod create_avatar_request; @@ -32,14 +34,18 @@ pub mod create_group_gallery_request; pub use self::create_group_gallery_request::CreateGroupGalleryRequest; pub mod create_group_invite_request; pub use self::create_group_invite_request::CreateGroupInviteRequest; +pub mod create_group_post_request; +pub use self::create_group_post_request::CreateGroupPostRequest; pub mod create_group_request; pub use self::create_group_request::CreateGroupRequest; pub mod create_group_role_request; pub use self::create_group_role_request::CreateGroupRoleRequest; +pub mod create_instance_request; +pub use self::create_instance_request::CreateInstanceRequest; pub mod create_world_request; pub use self::create_world_request::CreateWorldRequest; pub mod current_user; -pub use self::current_user::CurrentUser; +pub use self::current_user::{EitherUserOrTwoFactor, CurrentUser}; pub mod current_user_presence; pub use self::current_user_presence::CurrentUserPresence; pub mod deployment_group; @@ -76,6 +82,8 @@ pub mod friend_status; pub use self::friend_status::FriendStatus; pub mod group; pub use self::group::Group; +pub mod group_access_type; +pub use self::group_access_type::GroupAccessType; pub mod group_announcement; pub use self::group_announcement::GroupAnnouncement; pub mod group_audit_log_entry; @@ -84,6 +92,10 @@ pub mod group_gallery; pub use self::group_gallery::GroupGallery; pub mod group_gallery_image; pub use self::group_gallery_image::GroupGalleryImage; +pub mod group_instance; +pub use self::group_instance::GroupInstance; +pub mod group_join_request_action; +pub use self::group_join_request_action::GroupJoinRequestAction; pub mod group_join_state; pub use self::group_join_state::GroupJoinState; pub mod group_limited_member; @@ -98,12 +110,18 @@ pub mod group_my_member; pub use self::group_my_member::GroupMyMember; pub mod group_permission; pub use self::group_permission::GroupPermission; +pub mod group_post; +pub use self::group_post::GroupPost; +pub mod group_post_visibility; +pub use self::group_post_visibility::GroupPostVisibility; pub mod group_privacy; pub use self::group_privacy::GroupPrivacy; pub mod group_role; pub use self::group_role::GroupRole; pub mod group_role_template; pub use self::group_role_template::GroupRoleTemplate; +pub mod group_search_sort; +pub use self::group_search_sort::GroupSearchSort; pub mod group_user_visibility; pub use self::group_user_visibility::GroupUserVisibility; pub mod info_push; @@ -120,6 +138,8 @@ pub mod instance; pub use self::instance::Instance; pub mod instance_platforms; pub use self::instance_platforms::InstancePlatforms; +pub mod instance_region; +pub use self::instance_region::InstanceRegion; pub mod instance_short_name_response; pub use self::instance_short_name_response::InstanceShortNameResponse; pub mod instance_type; @@ -140,10 +160,14 @@ pub mod license_group; pub use self::license_group::LicenseGroup; pub mod license_type; pub use self::license_type::LicenseType; +pub mod limited_group; +pub use self::limited_group::LimitedGroup; pub mod limited_unity_package; pub use self::limited_unity_package::LimitedUnityPackage; pub mod limited_user; pub use self::limited_user::LimitedUser; +pub mod limited_user_groups; +pub use self::limited_user_groups::LimitedUserGroups; pub mod limited_world; pub use self::limited_world::LimitedWorld; pub mod mime_type; @@ -152,6 +176,16 @@ pub mod moderate_user_request; pub use self::moderate_user_request::ModerateUserRequest; pub mod notification; pub use self::notification::Notification; +pub mod notification_detail_invite; +pub use self::notification_detail_invite::NotificationDetailInvite; +pub mod notification_detail_invite_response; +pub use self::notification_detail_invite_response::NotificationDetailInviteResponse; +pub mod notification_detail_request_invite; +pub use self::notification_detail_request_invite::NotificationDetailRequestInvite; +pub mod notification_detail_request_invite_response; +pub use self::notification_detail_request_invite_response::NotificationDetailRequestInviteResponse; +pub mod notification_detail_vote_to_kick; +pub use self::notification_detail_vote_to_kick::NotificationDetailVoteToKick; pub mod notification_type; pub use self::notification_type::NotificationType; pub mod order_option; @@ -170,6 +204,8 @@ pub mod region; pub use self::region::Region; pub mod release_status; pub use self::release_status::ReleaseStatus; +pub mod represented_group; +pub use self::represented_group::RepresentedGroup; pub mod request_invite_request; pub use self::request_invite_request::RequestInviteRequest; pub mod respond_group_join_request; @@ -242,3 +278,4 @@ pub mod world_metadata; pub use self::world_metadata::WorldMetadata; pub mod world_publish_status; pub use self::world_publish_status::WorldPublishStatus; +pub mod tags; diff --git a/src/models/notification_detail_invite.rs b/src/models/notification_detail_invite.rs new file mode 100644 index 0000000..4b75c47 --- /dev/null +++ b/src/models/notification_detail_invite.rs @@ -0,0 +1,33 @@ +/* + * VRChat API Documentation + * + * + * Contact: vrchatapi.lpv0t@aries.fyi + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct NotificationDetailInvite { + #[serde(rename = "inviteMessage", skip_serializing_if = "Option::is_none")] + pub invite_message: Option, + /// WorldID be \"offline\" on User profiles if you are not friends with that user. + #[serde(rename = "worldId")] + pub world_id: String, + #[serde(rename = "worldName")] + pub world_name: String, +} + +impl NotificationDetailInvite { + pub fn new(world_id: String, world_name: String) -> NotificationDetailInvite { + NotificationDetailInvite { + invite_message: None, + world_id, + world_name, + } + } +} + + diff --git a/src/models/notification_detail_invite_response.rs b/src/models/notification_detail_invite_response.rs new file mode 100644 index 0000000..72b2166 --- /dev/null +++ b/src/models/notification_detail_invite_response.rs @@ -0,0 +1,29 @@ +/* + * VRChat API Documentation + * + * + * Contact: vrchatapi.lpv0t@aries.fyi + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct NotificationDetailInviteResponse { + #[serde(rename = "inResponseTo")] + pub in_response_to: String, + #[serde(rename = "responseMessage")] + pub response_message: String, +} + +impl NotificationDetailInviteResponse { + pub fn new(in_response_to: String, response_message: String) -> NotificationDetailInviteResponse { + NotificationDetailInviteResponse { + in_response_to, + response_message, + } + } +} + + diff --git a/src/models/notification_detail_request_invite.rs b/src/models/notification_detail_request_invite.rs new file mode 100644 index 0000000..f511c5d --- /dev/null +++ b/src/models/notification_detail_request_invite.rs @@ -0,0 +1,31 @@ +/* + * VRChat API Documentation + * + * + * Contact: vrchatapi.lpv0t@aries.fyi + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct NotificationDetailRequestInvite { + /// TODO: Does this still exist? + #[serde(rename = "platform", skip_serializing_if = "Option::is_none")] + pub platform: Option, + /// Used when using InviteMessage Slot. + #[serde(rename = "requestMessage", skip_serializing_if = "Option::is_none")] + pub request_message: Option, +} + +impl NotificationDetailRequestInvite { + pub fn new() -> NotificationDetailRequestInvite { + NotificationDetailRequestInvite { + platform: None, + request_message: None, + } + } +} + + diff --git a/src/models/notification_detail_request_invite_response.rs b/src/models/notification_detail_request_invite_response.rs new file mode 100644 index 0000000..37c8cb7 --- /dev/null +++ b/src/models/notification_detail_request_invite_response.rs @@ -0,0 +1,30 @@ +/* + * VRChat API Documentation + * + * + * Contact: vrchatapi.lpv0t@aries.fyi + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct NotificationDetailRequestInviteResponse { + #[serde(rename = "inResponseTo")] + pub in_response_to: String, + /// Used when using InviteMessage Slot. + #[serde(rename = "requestMessage", skip_serializing_if = "Option::is_none")] + pub request_message: Option, +} + +impl NotificationDetailRequestInviteResponse { + pub fn new(in_response_to: String) -> NotificationDetailRequestInviteResponse { + NotificationDetailRequestInviteResponse { + in_response_to, + request_message: None, + } + } +} + + diff --git a/src/models/notification_detail_vote_to_kick.rs b/src/models/notification_detail_vote_to_kick.rs new file mode 100644 index 0000000..8af004a --- /dev/null +++ b/src/models/notification_detail_vote_to_kick.rs @@ -0,0 +1,31 @@ +/* + * VRChat API Documentation + * + * + * Contact: vrchatapi.lpv0t@aries.fyi + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct NotificationDetailVoteToKick { + /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. + #[serde(rename = "initiatorUserId")] + pub initiator_user_id: String, + /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. + #[serde(rename = "userToKickId")] + pub user_to_kick_id: String, +} + +impl NotificationDetailVoteToKick { + pub fn new(initiator_user_id: String, user_to_kick_id: String) -> NotificationDetailVoteToKick { + NotificationDetailVoteToKick { + initiator_user_id, + user_to_kick_id, + } + } +} + + diff --git a/src/models/notification_type.rs b/src/models/notification_type.rs index eaa3f6e..dcd055f 100644 --- a/src/models/notification_type.rs +++ b/src/models/notification_type.rs @@ -16,6 +16,8 @@ pub enum NotificationType { Invite, #[serde(rename = "inviteResponse")] InviteResponse, + #[serde(rename = "message")] + Message, #[serde(rename = "requestInvite")] RequestInvite, #[serde(rename = "requestInviteResponse")] @@ -31,6 +33,7 @@ impl ToString for NotificationType { Self::FriendRequest => String::from("friendRequest"), Self::Invite => String::from("invite"), Self::InviteResponse => String::from("inviteResponse"), + Self::Message => String::from("message"), Self::RequestInvite => String::from("requestInvite"), Self::RequestInviteResponse => String::from("requestInviteResponse"), Self::Votetokick => String::from("votetokick"), diff --git a/src/models/represented_group.rs b/src/models/represented_group.rs new file mode 100644 index 0000000..66b64db --- /dev/null +++ b/src/models/represented_group.rs @@ -0,0 +1,66 @@ +/* + * VRChat API Documentation + * + * + * Contact: vrchatapi.lpv0t@aries.fyi + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct RepresentedGroup { + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "shortCode", skip_serializing_if = "Option::is_none")] + pub short_code: Option, + #[serde(rename = "discriminator", skip_serializing_if = "Option::is_none")] + pub discriminator: Option, + #[serde(rename = "description", skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "iconId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub icon_id: Option>, + #[serde(rename = "iconUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub icon_url: Option>, + #[serde(rename = "bannerId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub banner_id: Option>, + #[serde(rename = "bannerUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub banner_url: Option>, + #[serde(rename = "privacy", skip_serializing_if = "Option::is_none")] + pub privacy: Option, + /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. + #[serde(rename = "ownerId", skip_serializing_if = "Option::is_none")] + pub owner_id: Option, + #[serde(rename = "memberCount", skip_serializing_if = "Option::is_none")] + pub member_count: Option, + #[serde(rename = "groupId", skip_serializing_if = "Option::is_none")] + pub group_id: Option, + #[serde(rename = "memberVisibility", skip_serializing_if = "Option::is_none")] + pub member_visibility: Option, + #[serde(rename = "isRepresenting", skip_serializing_if = "Option::is_none")] + pub is_representing: Option, +} + +impl RepresentedGroup { + pub fn new() -> RepresentedGroup { + RepresentedGroup { + name: None, + short_code: None, + discriminator: None, + description: None, + icon_id: None, + icon_url: None, + banner_id: None, + banner_url: None, + privacy: None, + owner_id: None, + member_count: None, + group_id: None, + member_visibility: None, + is_representing: None, + } + } +} + + diff --git a/src/models/respond_group_join_request.rs b/src/models/respond_group_join_request.rs index bf29dbd..b32086c 100644 --- a/src/models/respond_group_join_request.rs +++ b/src/models/respond_group_join_request.rs @@ -11,14 +11,18 @@ #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct RespondGroupJoinRequest { - #[serde(rename = "action", skip_serializing_if = "Option::is_none")] - pub action: Option, + #[serde(rename = "action")] + pub action: crate::models::GroupJoinRequestAction, + /// Whether to block the user from requesting again + #[serde(rename = "block", skip_serializing_if = "Option::is_none")] + pub block: Option, } impl RespondGroupJoinRequest { - pub fn new() -> RespondGroupJoinRequest { + pub fn new(action: crate::models::GroupJoinRequestAction) -> RespondGroupJoinRequest { RespondGroupJoinRequest { - action: None, + action, + block: None, } } } diff --git a/src/models/sent_notification.rs b/src/models/sent_notification.rs index adc7584..b69d039 100644 --- a/src/models/sent_notification.rs +++ b/src/models/sent_notification.rs @@ -14,17 +14,16 @@ pub struct SentNotification { #[serde(rename = "created_at")] pub created_at: String, - /// **NOTICE:** This is not a JSON object, this is a json **encoded** object, meaning you have to json-de-encode to get the NotificationDetail object depending on the NotificationType. #[serde(rename = "details")] - pub details: String, + pub details: serde_json::Value, #[serde(rename = "id")] pub id: String, /// #[serde(rename = "message")] pub message: String, /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. - #[serde(rename = "recieverUserId")] - pub reciever_user_id: String, + #[serde(rename = "receiverUserId")] + pub receiver_user_id: String, /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. #[serde(rename = "senderUserId")] pub sender_user_id: String, @@ -37,13 +36,13 @@ pub struct SentNotification { impl SentNotification { /// - pub fn new(created_at: String, details: String, id: String, message: String, reciever_user_id: String, sender_user_id: String, r#type: crate::models::NotificationType) -> SentNotification { + pub fn new(created_at: String, details: serde_json::Value, id: String, message: String, receiver_user_id: String, sender_user_id: String, r#type: crate::models::NotificationType) -> SentNotification { SentNotification { created_at, details, id, message, - reciever_user_id, + receiver_user_id, sender_user_id, sender_username: None, r#type, diff --git a/src/models/subscription.rs b/src/models/subscription.rs index cdc2559..fd2d672 100644 --- a/src/models/subscription.rs +++ b/src/models/subscription.rs @@ -16,6 +16,14 @@ pub struct Subscription { pub id: String, #[serde(rename = "steamItemId")] pub steam_item_id: String, + #[serde(rename = "oculusSku", skip_serializing_if = "Option::is_none")] + pub oculus_sku: Option, + #[serde(rename = "googleProductId", skip_serializing_if = "Option::is_none")] + pub google_product_id: Option, + #[serde(rename = "googlePlanId", skip_serializing_if = "Option::is_none")] + pub google_plan_id: Option, + #[serde(rename = "picoSku", skip_serializing_if = "Option::is_none")] + pub pico_sku: Option, #[serde(rename = "amount")] pub amount: f32, #[serde(rename = "description")] @@ -32,6 +40,10 @@ impl Subscription { Subscription { id, steam_item_id, + oculus_sku: None, + google_product_id: None, + google_plan_id: None, + pico_sku: None, amount, description, period, diff --git a/src/models/tags.rs b/src/models/tags.rs new file mode 100644 index 0000000..2b973d9 --- /dev/null +++ b/src/models/tags.rs @@ -0,0 +1,462 @@ +use std::fmt::{Display, Formatter}; +use serde::{Deserialize, Serialize}; +macro_rules! impl_into_str { + ($type_from:ty, $type_to:ty) => { +impl From<&$type_from> for $type_to{ + fn from(value: &$type_from) -> Self { + value.get_tag() + } +} +impl From<$type_from> for $type_to{ + fn from(value: $type_from) -> Self { + value.get_tag() + } +} + }; +} +#[non_exhaustive] +#[derive(Debug, Ord, PartialOrd, Eq, PartialEq, Hash, Clone, Deserialize, Serialize)] +#[serde(try_from = "&str", into = "String")] +pub enum Tags{ + Language(String), + Show(ShowTags), + //Avatar Tags + Content(ContentTags), + Admin(AdminTags), + //Avatar Tags? + Author(AuthorTags), + //Favorite Group Start + Group(String), + World(String), + Avatars(String), + //Favorite Group end + System(SystemTags), +} + +impl Tags{ + pub fn get_tag(&self) -> String { + match self { + Tags::Language(language) => format!("language_{language}"), + Tags::Show(show) => format!("show_{}", show.get_tag()), + Tags::Content(content) => format!("content_{}", content.get_tag()), + Tags::Admin(admin) => format!("admin_{}", admin.get_tag()), + Tags::Author(author) => format!("author_{}", author.get_tag()), + Tags::Group(group) => format!("group_{group}"), + Tags::World(world) => format!("worlds{world}"), + Tags::Avatars(avatar) => format!("avatars{avatar}"), + Tags::System(system) => format!("system_{}", system.get_tag()), + } + } +} + +impl Display for Tags { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + match self { + Self::Language(language) => write!(f, "Language: {language}"), + Self::Show(show) => write!(f, "Show: {show}"), + Self::Content(content) => write!(f, "Content Warning: {content}"), + Self::Admin(admin) => write!(f, "Admin: {admin}"), + Self::Author(author) => write!(f, "Author: {author}"), + Self::Group(i) => write!(f, "User: {i}"), + Self::World(i) => write!(f, "World: {i}"), + Self::Avatars(i) => write!(f, "Avatars: {i}"), + Self::System(system) => write!(f, "System: {system}"), + } + } +} + +impl<'a> core::convert::TryFrom<&'a str> for Tags{ + type Error = &'a str; + fn try_from(value: &'a str) -> Result { + if let Some(lang) = value.strip_prefix("language_"){ + Ok(Self::Language(lang.to_string())) + } else if let Some(system) = value.strip_prefix("system_"){ + Ok(Self::System(SystemTags::try_from(system)?)) + } else if let Some(show) = value.strip_prefix("show_"){ + Ok(Self::Show(ShowTags::try_from(show)?)) + } else if let Some(show) = value.strip_prefix("content_"){ + Ok(Self::Content(ContentTags::try_from(show)?)) + }else if let Some(show) = value.strip_prefix("admin_"){ + Ok(Self::Admin(AdminTags::try_from(show)?)) + }else if let Some(show) = value.strip_prefix("author_"){ + Ok(Self::Author(AuthorTags::try_from(show)?)) + }else if let Some(group) = value.strip_prefix("group_"){ + Ok(Self::Group(group.to_string())) + }else if let Some(world) = value.strip_prefix("worlds"){ + Ok(Self::World(world.to_string())) + }else if let Some(avatar) = value.strip_prefix("avatars"){ + Ok(Self::Avatars(avatar.to_string())) + } else { + log::error!("NEW UNKNOWN TAG: {}", value); + Err(value) + } + } +} +impl_into_str!(Tags, String); + +#[non_exhaustive] +#[derive(Debug, Ord, PartialOrd, Eq, PartialEq, Hash, Clone, Deserialize, Serialize)] +#[serde(try_from = "&str", into = "&str")] +pub enum ShowTags{ + SocialRank, +} + +impl ShowTags{ + pub const fn get_tag(&self) -> &'static str { + match self { + Self::SocialRank => "social_rank", + } + } +} + +impl Display for ShowTags{ + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + match self{ + Self::SocialRank => write!(f, "Show Social Rank"), + } + } +} +impl<'a> core::convert::TryFrom<&'a str> for ShowTags{ + type Error = &'a str; + fn try_from(value: &'a str) -> Result { + match value { + "social_rank" => Ok(Self::SocialRank), + other => { + log::error!("NEW UNKNOWN TAG: show_{}", value); + Err(other) + } + } + } +} +impl_into_str!(ShowTags, &'static str); + +#[non_exhaustive] +#[derive(Debug, Ord, PartialOrd, Eq, PartialEq, Hash, Clone, Deserialize, Serialize)] +#[serde(try_from = "&str", into = "&str")] +pub enum ContentTags{ + Sex, + Adult, + Violence, + Gore, + Horror, + Other, +} + +impl ContentTags{ + pub const fn get_tag(&self) -> &'static str { + match self { + Self::Sex => "sex", + Self::Adult => "adult", + Self::Violence => "violence", + Self::Gore => "gore", + Self::Horror => "horror", + Self::Other => "other", + } + } +} + +impl Display for ContentTags{ + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + match self{ + Self::Sex => write!(f, "Sexually Suggestive"), + Self::Adult => write!(f, "Adult Language and Themes"), + Self::Violence => write!(f, "Graphic Violence"), + Self::Gore => write!(f, "Excessive Gore"), + Self::Horror => write!(f, "Extreme Horror"), + Self::Other => write!(f, "Other Content Warning"), + } + } +} +impl<'a> core::convert::TryFrom<&'a str> for ContentTags{ + type Error = &'a str; + fn try_from(value: &'a str) -> Result { + match value { + "sex" => Ok(Self::Sex), + "adult" => Ok(Self::Adult), + "violence" => Ok(Self::Violence), + "gore" => Ok(Self::Gore), + "horror" => Ok(Self::Horror), + "other" => Ok(Self::Other), + other => { + log::error!("NEW UNKNOWN TAG: content_{}", value); + Err(other) + } + } + } +} +impl_into_str!(ContentTags, &'static str); + +#[non_exhaustive] +#[derive(Debug, Ord, PartialOrd, Eq, PartialEq, Hash, Clone, Deserialize, Serialize)] +#[serde(try_from = "&str", into = "String")] +pub enum AdminTags{ + ContentReviewed, + QuestFallbackExtended, + Featured(FeaturedTags), +} + +impl AdminTags{ + pub fn get_tag(&self) -> String { + match self { + Self::ContentReviewed => String::from("content_reviewed"), + Self::QuestFallbackExtended => String::from("quest_fallback_extended"), + Self::Featured(feature) => format!("featured_{}", feature.get_tag()), + } + } +} + +impl<'a> core::convert::TryFrom<&'a str> for AdminTags { + type Error = &'a str; + fn try_from(value: &'a str) -> Result { + if let Some(featured) = value.strip_prefix("featured_"){ + Ok(Self::Featured(FeaturedTags::try_from(featured)?)) + } else{ + match value { + "content_reviewed" => Ok(Self::ContentReviewed), + "quest_fallback_extended" => Ok(Self::QuestFallbackExtended), + other => { + log::error!("NEW UNKNOWN TAG: admin_{other}"); + Err(other) + } + } + } + } +} +impl_into_str!(AdminTags, String); + +impl Display for AdminTags{ + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + match self{ + Self::ContentReviewed => write!(f, "Content Reviewed"), + Self::QuestFallbackExtended => write!(f, "Extended Quest Fallback"), + Self::Featured(featured) => write!(f, "Featured: {featured}"), + } + } +} + +#[non_exhaustive] +#[derive(Debug, Ord, PartialOrd, Eq, PartialEq, Hash, Clone, Deserialize, Serialize)] +#[serde(try_from = "&str", into = "&str")] +pub enum FeaturedTags { + LegacyContent, + Quest, +} + +impl FeaturedTags{ + pub const fn get_tag(&self) -> &'static str { + match self { + Self::LegacyContent => "legacy", + Self::Quest => "quest", + } + } +} + +impl<'a> core::convert::TryFrom<&'a str> for FeaturedTags{ + type Error = &'a str; + fn try_from(value: &'a str) -> Result { + match value { + "legacy" => Ok(Self::LegacyContent), + "quest" => Ok(Self::Quest), + other => { + log::error!("NEW UNKNOWN TAG: admin_featured_{value}"); + Err(other) + } + } + } +} +impl_into_str!(FeaturedTags, &'static str); + +impl Display for FeaturedTags { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + match self { + Self::LegacyContent => write!(f, "Legacy Content"), + Self::Quest => write!(f, "Quest"), + } + } +} + +#[non_exhaustive] +#[derive(Debug, Ord, PartialOrd, Eq, PartialEq, Hash, Clone, Deserialize, Serialize)] +#[serde(try_from = "&str", into = "&str")] +pub enum AuthorTags { + QuestFallback, +} +impl AuthorTags{ + pub const fn get_tag(&self) -> &'static str { + match self { + Self::QuestFallback => "quest_fallback", + } + } +} +impl<'a> core::convert::TryFrom<&'a str> for AuthorTags { + type Error = &'a str; + fn try_from(value: &'a str) -> Result { + match value { + "quest_fallback" => Ok(Self::QuestFallback), + other => { + log::error!("NEW UNKNOWN TAG: author_{value}"); + Err(other) + } + } + } +} +impl_into_str!(AuthorTags, &'static str); + +impl Display for AuthorTags { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + match self { + Self::QuestFallback => write!(f, "Quest Fallback"), + } + } +} + +#[non_exhaustive] +#[derive(Debug, Ord, PartialOrd, Eq, PartialEq, Hash, Clone, Deserialize, Serialize)] +#[serde(try_from = "&str", into = "String")] +pub enum SystemTags { + Access(SystemAccess), + Trust(SystemTrust), + Jam(String), + EarlyAdopter, + Supporter, + NoCaptcha, +} +impl SystemTags{ + pub fn get_tag(&self) -> String { + match self { + Self::Access(access) => format!("{}_access", access.get_tag()), + Self::Trust(trust) => format!("trust_{}", trust.get_tag()), + Self::Jam(id) => format!("jam{id}"), + Self::EarlyAdopter => "early_adopter".to_string(), + Self::Supporter => "supporter".to_string(), + Self::NoCaptcha => "no_captcha".to_string(), + } + } +} +impl Display for SystemTags { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + match self { + Self::Access(access) => write!(f, "{access}"), + Self::Trust(trust) => write!(f, "Trust: {trust}"), + Self::Jam(jam) => write!(f, "Jam: {jam}"), + Self::EarlyAdopter => write!(f, "EarlyAdopter"), + Self::Supporter => write!(f, "Supporter"), + Self::NoCaptcha => write!(f, "NoCaptcha"), + } + } +} + +impl<'a> core::convert::TryFrom<&'a str> for SystemTags{ + type Error = &'a str; + fn try_from(value: &'a str) -> Result { + if let Some(access) = value.strip_suffix("_access") { + Ok(Self::Access(SystemAccess::try_from(access)?)) + } else if let Some(trust) = value.strip_prefix("trust_") { + Ok(Self::Trust(SystemTrust::try_from(trust)?)) + }else if let Some(jam) = value.strip_prefix("jam") { + Ok(Self::Jam(jam.to_string())) + } else { + match value{ + "early_adopter" => Ok(Self::EarlyAdopter), + "supporter" => Ok(Self::Supporter), + "no_captcha" => Ok(Self::NoCaptcha), + value=> { + log::error!("NEW UNKNOWN TAG: system_{}", value); + Err(value) + }, + } + } + } +} +impl_into_str!(SystemTags, String); + +#[non_exhaustive] +#[derive(Debug, Ord, PartialOrd, Eq, PartialEq, Hash, Clone, Deserialize, Serialize)] +#[serde(try_from = "&str", into = "&str")] +pub enum SystemTrust { + Veteran, + Trusted, + Known, + Basic, + //Visitors have no Trust tag +} +impl SystemTrust{ + pub const fn get_tag(&self) -> &'static str { + match self { + Self::Basic => "basic", + Self::Known => "known", + Self::Trusted => "trusted", + Self::Veteran => "veteran", + } + } +} +impl Display for SystemTrust { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + match self { + Self::Basic => write!(f, "New User"), + Self::Known => write!(f, "User"), + Self::Trusted => write!(f, "Known User"), + Self::Veteran => write!(f, "Trusted User"), + } + } +} + +impl<'a> core::convert::TryFrom<&'a str> for SystemTrust { + type Error = &'a str; + fn try_from(value: &'a str) -> Result { + match value { + "basic" => Ok(Self::Basic), + "known" => Ok(Self::Known), + "trusted" => Ok(Self::Trusted), + "veteran" => Ok(Self::Veteran), + other => { + log::error!("NEW UNKNOWN TAG: system_trust_{}", value); + Err(other) + } + } + } +} +impl_into_str!(SystemTrust, &'static str); + +#[non_exhaustive] +#[derive(Debug, Ord, PartialOrd, Eq, PartialEq, Hash, Clone, Deserialize, Serialize)] +#[serde(try_from = "&str", into = "&str")] +pub enum SystemAccess { + Avatar, + World, + Feedback, +} +impl SystemAccess{ + pub const fn get_tag(&self) -> &'static str { + match self { + Self::Avatar => "avatar", + Self::World => "world", + Self::Feedback => "feedback", + } + } +} +impl Display for SystemAccess { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + match self { + Self::Avatar => write!(f, "Avatar Access"), + Self::World => write!(f, "World Access"), + Self::Feedback => write!(f, "Feedback Access"), + } + } +} + +impl<'a> core::convert::TryFrom<&'a str> for SystemAccess{ + type Error = &'a str; + fn try_from(value: &'a str) -> Result { + match value { + "avatar" => Ok(Self::Avatar), + "world" => Ok(Self::World), + "feedback" => Ok(Self::Feedback), + other => { + log::error!("NEW UNKNOWN TAG: system_{}_access", value); + Err(other) + } + } + } +} +impl_into_str!(SystemAccess, &'static str); \ No newline at end of file diff --git a/src/models/transaction.rs b/src/models/transaction.rs index b58d0ca..ec2b71e 100644 --- a/src/models/transaction.rs +++ b/src/models/transaction.rs @@ -14,6 +14,11 @@ pub struct Transaction { #[serde(rename = "id")] pub id: String, + /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. + #[serde(rename = "userId", skip_serializing_if = "Option::is_none")] + pub user_id: Option, + #[serde(rename = "userDisplayName", skip_serializing_if = "Option::is_none")] + pub user_display_name: Option, #[serde(rename = "status")] pub status: crate::models::TransactionStatus, #[serde(rename = "subscription")] @@ -30,6 +35,10 @@ pub struct Transaction { pub agreement: Option>, #[serde(rename = "error")] pub error: String, + #[serde(rename = "isGift", skip_serializing_if = "Option::is_none")] + pub is_gift: Option, + #[serde(rename = "isTokens", skip_serializing_if = "Option::is_none")] + pub is_tokens: Option, } impl Transaction { @@ -37,6 +46,8 @@ impl Transaction { pub fn new(id: String, status: crate::models::TransactionStatus, subscription: crate::models::Subscription, sandbox: bool, created_at: String, updated_at: String, error: String) -> Transaction { Transaction { id, + user_id: None, + user_display_name: None, status, subscription: Box::new(subscription), sandbox, @@ -45,6 +56,8 @@ impl Transaction { steam: None, agreement: None, error, + is_gift: None, + is_tokens: None, } } } diff --git a/src/models/unity_package.rs b/src/models/unity_package.rs index 9ed8450..7d7479d 100644 --- a/src/models/unity_package.rs +++ b/src/models/unity_package.rs @@ -12,16 +12,16 @@ #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct UnityPackage { - #[serde(rename = "assetUrl", skip_serializing_if = "Option::is_none")] - pub asset_url: Option, + #[serde(rename = "id")] + pub id: String, + #[serde(rename = "assetUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub asset_url: Option>, #[serde(rename = "assetUrlObject", skip_serializing_if = "Option::is_none")] pub asset_url_object: Option, #[serde(rename = "assetVersion")] pub asset_version: i32, #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] pub created_at: Option, - #[serde(rename = "id")] - pub id: String, /// This can be `standalonewindows` or `android`, but can also pretty much be any random Unity verison such as `2019.2.4-801-Release` or `2019.2.2-772-Release` or even `unknownplatform`. #[serde(rename = "platform")] pub platform: String, @@ -33,22 +33,31 @@ pub struct UnityPackage { pub unity_sort_number: Option, #[serde(rename = "unityVersion")] pub unity_version: String, + #[serde(rename = "impostorUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub impostor_url: Option>, + #[serde(rename = "scanStatus", skip_serializing_if = "Option::is_none")] + pub scan_status: Option, + #[serde(rename = "variant", skip_serializing_if = "Option::is_none")] + pub variant: Option, } impl UnityPackage { /// - pub fn new(asset_version: i32, id: String, platform: String, unity_version: String) -> UnityPackage { + pub fn new(id: String, asset_version: i32, platform: String, unity_version: String) -> UnityPackage { UnityPackage { + id, asset_url: None, asset_url_object: None, asset_version, created_at: None, - id, platform, plugin_url: None, plugin_url_object: None, unity_sort_number: None, unity_version, + impostor_url: None, + scan_status: None, + variant: None, } } } diff --git a/src/models/update_avatar_request.rs b/src/models/update_avatar_request.rs index 8a27e1f..cb68d7d 100644 --- a/src/models/update_avatar_request.rs +++ b/src/models/update_avatar_request.rs @@ -30,6 +30,8 @@ pub struct UpdateAvatarRequest { pub version: Option, #[serde(rename = "unityPackageUrl", skip_serializing_if = "Option::is_none")] pub unity_package_url: Option, + #[serde(rename = "unityVersion", skip_serializing_if = "Option::is_none")] + pub unity_version: Option, } impl UpdateAvatarRequest { @@ -44,6 +46,7 @@ impl UpdateAvatarRequest { release_status: None, version: None, unity_package_url: None, + unity_version: None, } } } diff --git a/src/models/update_user_request.rs b/src/models/update_user_request.rs index 9e2c520..c02a6e3 100644 --- a/src/models/update_user_request.rs +++ b/src/models/update_user_request.rs @@ -28,6 +28,8 @@ pub struct UpdateUserRequest { pub bio: Option, #[serde(rename = "bioLinks", skip_serializing_if = "Option::is_none")] pub bio_links: Option>, + #[serde(rename = "pronouns", skip_serializing_if = "Option::is_none")] + pub pronouns: Option, /// MUST be a valid VRChat /file/ url. #[serde(rename = "userIcon", skip_serializing_if = "Option::is_none")] pub user_icon: Option, @@ -44,6 +46,7 @@ impl UpdateUserRequest { status_description: None, bio: None, bio_links: None, + pronouns: None, user_icon: None, } } diff --git a/src/models/user.rs b/src/models/user.rs index 1e3d394..09315ac 100644 --- a/src/models/user.rs +++ b/src/models/user.rs @@ -13,6 +13,9 @@ pub struct User { #[serde(rename = "allowAvatarCopying")] pub allow_avatar_copying: bool, + /// + #[serde(rename = "badges", skip_serializing_if = "Option::is_none")] + pub badges: Option>, #[serde(rename = "bio")] pub bio: String, #[serde(rename = "bioLinks")] @@ -23,6 +26,8 @@ pub struct User { /// When profilePicOverride is not empty, use it instead. #[serde(rename = "currentAvatarThumbnailImageUrl")] pub current_avatar_thumbnail_image_url: String, + #[serde(rename = "currentAvatarTags")] + pub current_avatar_tags: Vec, #[serde(rename = "date_joined")] pub date_joined: String, #[serde(rename = "developerType")] @@ -59,6 +64,8 @@ pub struct User { pub note: Option, #[serde(rename = "profilePicOverride")] pub profile_pic_override: String, + #[serde(rename = "pronouns")] + pub pronouns: String, #[serde(rename = "state")] pub state: crate::models::UserState, #[serde(rename = "status")] @@ -67,7 +74,7 @@ pub struct User { pub status_description: String, /// #[serde(rename = "tags")] - pub tags: Vec, + pub tags: Vec, #[serde(rename = "travelingToInstance", skip_serializing_if = "Option::is_none")] pub traveling_to_instance: Option, #[serde(rename = "travelingToLocation", skip_serializing_if = "Option::is_none")] @@ -85,13 +92,15 @@ pub struct User { } impl User { - pub fn new(allow_avatar_copying: bool, bio: String, bio_links: Vec, current_avatar_image_url: String, current_avatar_thumbnail_image_url: String, date_joined: String, developer_type: crate::models::DeveloperType, display_name: String, friend_key: String, id: String, is_friend: bool, last_activity: String, last_login: String, last_platform: String, profile_pic_override: String, state: crate::models::UserState, status: crate::models::UserStatus, status_description: String, tags: Vec, user_icon: String) -> User { + pub fn new(allow_avatar_copying: bool, bio: String, bio_links: Vec, current_avatar_image_url: String, current_avatar_thumbnail_image_url: String, current_avatar_tags: Vec, date_joined: String, developer_type: crate::models::DeveloperType, display_name: String, friend_key: String, id: String, is_friend: bool, last_activity: String, last_login: String, last_platform: String, profile_pic_override: String, pronouns: String, state: crate::models::UserState, status: crate::models::UserStatus, status_description: String, tags: Vec, user_icon: String) -> User { User { allow_avatar_copying, + badges: None, bio, bio_links, current_avatar_image_url, current_avatar_thumbnail_image_url, + current_avatar_tags, date_joined, developer_type, display_name, @@ -106,6 +115,7 @@ impl User { location: None, note: None, profile_pic_override, + pronouns, state, status, status_description, diff --git a/src/models/world.rs b/src/models/world.rs index 0c0b406..550da5b 100644 --- a/src/models/world.rs +++ b/src/models/world.rs @@ -43,8 +43,8 @@ pub struct World { pub labs_publication_date: String, #[serde(rename = "name")] pub name: String, - #[serde(rename = "namespace")] - pub namespace: String, + #[serde(rename = "namespace", skip_serializing_if = "Option::is_none")] + pub namespace: Option, /// Will always be `0` when unauthenticated. #[serde(rename = "occupants", skip_serializing_if = "Option::is_none")] pub occupants: Option, @@ -66,7 +66,7 @@ pub struct World { pub release_status: crate::models::ReleaseStatus, /// #[serde(rename = "tags")] - pub tags: Vec, + pub tags: Vec, #[serde(rename = "thumbnailImageUrl")] pub thumbnail_image_url: String, /// Empty if unauthenticated. @@ -78,11 +78,13 @@ pub struct World { pub version: i32, #[serde(rename = "visits")] pub visits: i32, + #[serde(rename = "udonProducts", skip_serializing_if = "Option::is_none")] + pub udon_products: Option>, } impl World { /// - pub fn new(author_id: String, author_name: String, capacity: i32, recommended_capacity: i32, created_at: String, description: String, featured: bool, heat: i32, id: String, image_url: String, labs_publication_date: String, name: String, namespace: String, organization: String, popularity: i32, publication_date: String, release_status: crate::models::ReleaseStatus, tags: Vec, thumbnail_image_url: String, updated_at: String, version: i32, visits: i32) -> World { + pub fn new(author_id: String, author_name: String, capacity: i32, recommended_capacity: i32, created_at: String, description: String, featured: bool, heat: i32, id: String, image_url: String, labs_publication_date: String, name: String, organization: String, popularity: i32, publication_date: String, release_status: crate::models::ReleaseStatus, tags: Vec, thumbnail_image_url: String, updated_at: String, version: i32, visits: i32) -> World { World { author_id, author_name, @@ -98,7 +100,7 @@ impl World { instances: None, labs_publication_date, name, - namespace, + namespace: None, occupants: None, organization, popularity, @@ -113,6 +115,7 @@ impl World { updated_at, version, visits, + udon_products: None, } } } diff --git a/src/models/world_publish_status.rs b/src/models/world_publish_status.rs index 346fa64..8b63c4a 100644 --- a/src/models/world_publish_status.rs +++ b/src/models/world_publish_status.rs @@ -11,14 +11,14 @@ #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct WorldPublishStatus { - #[serde(rename = "canPubilsh")] - pub can_pubilsh: bool, + #[serde(rename = "canPublish")] + pub can_publish: bool, } impl WorldPublishStatus { - pub fn new(can_pubilsh: bool) -> WorldPublishStatus { + pub fn new(can_publish: bool) -> WorldPublishStatus { WorldPublishStatus { - can_pubilsh, + can_publish, } } }