diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 36ec247..f20d27a 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -17,6 +17,7 @@ docs/DeploymentGroup.md docs/DeveloperType.md docs/DownloadUrlList.md docs/DynamicWorldRow.md +docs/EconomyApi.md docs/Error.md docs/Favorite.md docs/FavoriteGroup.md @@ -33,7 +34,6 @@ docs/FilesApi.md docs/FinishFileDataUploadRequest.md docs/FriendStatus.md docs/FriendsApi.md -docs/InlineResponse404.md docs/Instance.md docs/InstancePlatforms.md docs/InstancesApi.md @@ -42,6 +42,10 @@ docs/InviteMessage.md docs/InviteMessageType.md docs/InviteRequest.md docs/InviteResponse.md +docs/License.md +docs/LicenseAction.md +docs/LicenseGroup.md +docs/LicenseType.md docs/LimitedUnityPackage.md docs/LimitedUser.md docs/LimitedWorld.md @@ -59,8 +63,15 @@ docs/PlayermoderationApi.md docs/PublicAnnouncement.md docs/ReleaseStatus.md docs/Response.md +docs/Subscription.md +docs/SubscriptionPeriod.md docs/Success.md docs/SystemApi.md +docs/Transaction.md +docs/TransactionAgreement.md +docs/TransactionStatus.md +docs/TransactionSteamInfo.md +docs/TransactionSteamWalletInfo.md docs/TwoFactorAuthCode.md docs/UnityPackage.md docs/UpdateAvatarRequest.md @@ -72,6 +83,7 @@ docs/User.md docs/UserExists.md docs/UserState.md docs/UserStatus.md +docs/UserSubscription.md docs/UsersApi.md docs/Verify2FaResult.md docs/VerifyAuthTokenResult.md @@ -83,6 +95,7 @@ git_push.sh src/apis/authentication_api.rs src/apis/avatars_api.rs src/apis/configuration.rs +src/apis/economy_api.rs src/apis/favorites_api.rs src/apis/files_api.rs src/apis/friends_api.rs @@ -124,13 +137,16 @@ src/models/file_version.rs src/models/file_version_upload_status.rs src/models/finish_file_data_upload_request.rs src/models/friend_status.rs -src/models/inline_response_404.rs src/models/instance.rs src/models/instance_platforms.rs src/models/invite_message.rs src/models/invite_message_type.rs src/models/invite_request.rs src/models/invite_response.rs +src/models/license.rs +src/models/license_action.rs +src/models/license_group.rs +src/models/license_type.rs src/models/limited_unity_package.rs src/models/limited_user.rs src/models/limited_world.rs @@ -146,7 +162,14 @@ src/models/player_moderation_type.rs src/models/public_announcement.rs src/models/release_status.rs src/models/response.rs +src/models/subscription.rs +src/models/subscription_period.rs src/models/success.rs +src/models/transaction.rs +src/models/transaction_agreement.rs +src/models/transaction_status.rs +src/models/transaction_steam_info.rs +src/models/transaction_steam_wallet_info.rs src/models/two_factor_auth_code.rs src/models/unity_package.rs src/models/update_avatar_request.rs @@ -158,6 +181,7 @@ src/models/user.rs src/models/user_exists.rs src/models/user_state.rs src/models/user_status.rs +src/models/user_subscription.rs src/models/verify2_fa_result.rs src/models/verify_auth_token_result.rs src/models/world.rs diff --git a/Cargo.toml b/Cargo.toml index e88e884..c796133 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "vrchatapi" -version = "1.5.1" +version = "1.5.2" authors = ["OpenAPI Generator team and contributors"] license = "MIT" edition = "2018" diff --git a/docs/EconomyApi.md b/docs/EconomyApi.md new file mode 100644 index 0000000..80334d4 --- /dev/null +++ b/docs/EconomyApi.md @@ -0,0 +1,154 @@ +# \EconomyApi + +All URIs are relative to *https://api.vrchat.cloud/api/1* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_current_subscriptions**](EconomyApi.md#get_current_subscriptions) | **GET** /auth/user/subscription | Get Current Subscriptions +[**get_license_group**](EconomyApi.md#get_license_group) | **GET** /licenseGroups/{licenseGroupId} | Get License Group +[**get_steam_transaction**](EconomyApi.md#get_steam_transaction) | **GET** /Steam/transactions/{transactionId} | Get Steam Transaction +[**get_steam_transactions**](EconomyApi.md#get_steam_transactions) | **GET** /Steam/transactions | List Steam Transactions +[**get_subscriptions**](EconomyApi.md#get_subscriptions) | **GET** /subscriptions | List Subscriptions + + + +## get_current_subscriptions + +> Vec get_current_subscriptions() +Get Current Subscriptions + +Get a list of all current user subscriptions. + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**Vec**](UserSubscription.md) + +### Authorization + +[apiKeyCookie](../README.md#apiKeyCookie), [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_license_group + +> crate::models::LicenseGroup get_license_group(license_group_id) +Get License Group + +Get a single License Group by given ID. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**license_group_id** | **String** | | [required] | + +### Return type + +[**crate::models::LicenseGroup**](LicenseGroup.md) + +### Authorization + +[apiKeyCookie](../README.md#apiKeyCookie), [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_steam_transaction + +> crate::models::Transaction get_steam_transaction(transaction_id) +Get Steam Transaction + +Get a single Steam transactions by ID. This returns the exact same information as `getSteamTransactions`, so no point in using this endpoint. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**transaction_id** | **String** | | [required] | + +### Return type + +[**crate::models::Transaction**](Transaction.md) + +### Authorization + +[apiKeyCookie](../README.md#apiKeyCookie), [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_steam_transactions + +> Vec get_steam_transactions() +List Steam Transactions + +Get all own Steam transactions. + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**Vec**](Transaction.md) + +### Authorization + +[apiKeyCookie](../README.md#apiKeyCookie), [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_subscriptions + +> Vec get_subscriptions() +List Subscriptions + +List all existing Subscriptions. For example, \"vrchatplus-monthly\" and \"vrchatplus-yearly\". + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**Vec**](Subscription.md) + +### Authorization + +[apiKeyCookie](../README.md#apiKeyCookie), [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) + diff --git a/docs/InviteApi.md b/docs/InviteApi.md index 4128482..ca893b8 100644 --- a/docs/InviteApi.md +++ b/docs/InviteApi.md @@ -143,7 +143,7 @@ Name | Type | Description | Required | Notes > Vec reset_invite_message(user_id, message_type, slot) Reset Invite Message -Resets a single Invite Message back to it's 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. +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. ### Parameters diff --git a/docs/License.md b/docs/License.md new file mode 100644 index 0000000..d823bf0 --- /dev/null +++ b/docs/License.md @@ -0,0 +1,14 @@ +# License + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**for_id** | **String** | Either a AvatarID, LicenseGroupID, PermissionID or ProductID. This depends on the `forType` field. | +**for_type** | [**crate::models::LicenseType**](LicenseType.md) | | +**for_name** | **String** | | +**for_action** | [**crate::models::LicenseAction**](LicenseAction.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/InlineResponse404.md b/docs/LicenseAction.md similarity index 78% rename from docs/InlineResponse404.md rename to docs/LicenseAction.md index 2727fee..e2d3dc1 100644 --- a/docs/InlineResponse404.md +++ b/docs/LicenseAction.md @@ -1,10 +1,9 @@ -# InlineResponse404 +# LicenseAction ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**error** | [**crate::models::Error**](Error.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/LicenseGroup.md b/docs/LicenseGroup.md new file mode 100644 index 0000000..c826faf --- /dev/null +++ b/docs/LicenseGroup.md @@ -0,0 +1,14 @@ +# LicenseGroup + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | +**name** | **String** | | +**description** | **String** | | +**licenses** | [**Vec**](License.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/LicenseType.md b/docs/LicenseType.md new file mode 100644 index 0000000..f6ff05c --- /dev/null +++ b/docs/LicenseType.md @@ -0,0 +1,10 @@ +# LicenseType + +## 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/Subscription.md b/docs/Subscription.md new file mode 100644 index 0000000..bca85e6 --- /dev/null +++ b/docs/Subscription.md @@ -0,0 +1,16 @@ +# Subscription + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | +**steam_item_id** | **String** | | +**amount** | **f32** | | +**description** | **String** | | +**period** | [**crate::models::SubscriptionPeriod**](SubscriptionPeriod.md) | | +**tier** | **f32** | | + +[[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/SubscriptionPeriod.md b/docs/SubscriptionPeriod.md new file mode 100644 index 0000000..b914cca --- /dev/null +++ b/docs/SubscriptionPeriod.md @@ -0,0 +1,10 @@ +# SubscriptionPeriod + +## 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/Transaction.md b/docs/Transaction.md new file mode 100644 index 0000000..d808dd1 --- /dev/null +++ b/docs/Transaction.md @@ -0,0 +1,19 @@ +# Transaction + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | +**status** | [**crate::models::TransactionStatus**](TransactionStatus.md) | | +**subscription** | [**crate::models::Subscription**](Subscription.md) | | +**sandbox** | **bool** | | [default to false] +**created_at** | **String** | | +**updated_at** | **String** | | +**steam** | Option<[**crate::models::TransactionSteamInfo**](TransactionSteamInfo.md)> | | [optional] +**agreement** | Option<[**crate::models::TransactionAgreement**](TransactionAgreement.md)> | | [optional] +**error** | **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/TransactionAgreement.md b/docs/TransactionAgreement.md new file mode 100644 index 0000000..00a9a74 --- /dev/null +++ b/docs/TransactionAgreement.md @@ -0,0 +1,27 @@ +# TransactionAgreement + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**agreement_id** | **String** | | +**item_id** | **f32** | | +**status** | **String** | This is NOT TransactionStatus, but whatever Steam return. | +**period** | **String** | | +**frequency** | **f32** | | +**billing_type** | **String** | | +**start_date** | **String** | | +**end_date** | **String** | | +**recurring_amt** | **f32** | | +**currency** | **String** | | +**time_created** | **String** | | +**next_payment** | **String** | | +**last_payment** | **String** | | +**last_amount** | **f32** | | +**last_amount_vat** | **f32** | | +**outstanding** | **f32** | | +**failed_attempts** | **f32** | | + +[[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/TransactionStatus.md b/docs/TransactionStatus.md new file mode 100644 index 0000000..30a9bbe --- /dev/null +++ b/docs/TransactionStatus.md @@ -0,0 +1,10 @@ +# TransactionStatus + +## 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/TransactionSteamInfo.md b/docs/TransactionSteamInfo.md new file mode 100644 index 0000000..ed1d448 --- /dev/null +++ b/docs/TransactionSteamInfo.md @@ -0,0 +1,15 @@ +# TransactionSteamInfo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**wallet_info** | [**crate::models::TransactionSteamWalletInfo**](TransactionSteamWalletInfo.md) | | +**steam_id** | **String** | Steam User ID | +**order_id** | **String** | Steam Order ID | +**steam_url** | **String** | Empty | +**trans_id** | **String** | Steam Transaction ID, NOT the same as VRChat TransactionID | + +[[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/TransactionSteamWalletInfo.md b/docs/TransactionSteamWalletInfo.md new file mode 100644 index 0000000..1255b63 --- /dev/null +++ b/docs/TransactionSteamWalletInfo.md @@ -0,0 +1,14 @@ +# TransactionSteamWalletInfo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**state** | **String** | | +**country** | **String** | | [default to US] +**currency** | **String** | | [default to USD] +**status** | **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/UserSubscription.md b/docs/UserSubscription.md new file mode 100644 index 0000000..3e24739 --- /dev/null +++ b/docs/UserSubscription.md @@ -0,0 +1,25 @@ +# UserSubscription + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | +**transaction_id** | **String** | | +**store** | **String** | Which \"Store\" it came from. Right now only Stores are \"Steam\" and \"Admin\". | +**steam_item_id** | Option<**String**> | | [optional] +**amount** | **f32** | | +**description** | **String** | | +**period** | [**crate::models::SubscriptionPeriod**](SubscriptionPeriod.md) | | +**tier** | **f32** | | +**active** | **bool** | | [default to true] +**status** | [**crate::models::TransactionStatus**](TransactionStatus.md) | | +**expires** | **String** | | +**created_at** | **String** | | +**updated_at** | **String** | | +**license_groups** | **Vec** | | +**is_gift** | **bool** | | [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/src/apis/economy_api.rs b/src/apis/economy_api.rs new file mode 100644 index 0000000..9746580 --- /dev/null +++ b/src/apis/economy_api.rs @@ -0,0 +1,196 @@ +/* + * VRChat API Documentation + * + * + * Contact: me@ruby.js.org + * Generated by: https://openapi-generator.tech + */ + + +use reqwest; + +use crate::apis::ResponseContent; +use super::{Error, configuration}; + + +/// struct for typed errors of method [`get_current_subscriptions`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetCurrentSubscriptionsError { + Status401(crate::models::Error), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_license_group`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetLicenseGroupError { + Status401(crate::models::Error), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_steam_transaction`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetSteamTransactionError { + Status401(crate::models::Error), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_steam_transactions`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetSteamTransactionsError { + Status401(crate::models::Error), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_subscriptions`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetSubscriptionsError { + Status401(crate::models::Error), + UnknownValue(serde_json::Value), +} + + +/// 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)) + } +} + +/// 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)) + } +} + +/// 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)) + } +} + +/// 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)) + } +} + +/// 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)) + } +} + diff --git a/src/apis/invite_api.rs b/src/apis/invite_api.rs index ba45275..f2759f8 100644 --- a/src/apis/invite_api.rs +++ b/src/apis/invite_api.rs @@ -54,7 +54,7 @@ pub enum RequestInviteError { pub enum ResetInviteMessageError { Status400(crate::models::Error), Status401(crate::models::Error), - Status404(crate::models::InlineResponse404), + Status404(crate::models::Error), Status429(crate::models::Error), UnknownValue(serde_json::Value), } @@ -191,7 +191,7 @@ pub fn request_invite(configuration: &configuration::Configuration, user_id: &st } } -/// Resets a single Invite Message back to it's 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. +/// 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: &str, slot: i32) -> Result, Error> { let local_var_configuration = configuration; diff --git a/src/apis/mod.rs b/src/apis/mod.rs index bb881a0..5bd3412 100644 --- a/src/apis/mod.rs +++ b/src/apis/mod.rs @@ -63,6 +63,7 @@ pub fn urlencode>(s: T) -> String { pub mod authentication_api; pub mod avatars_api; +pub mod economy_api; pub mod favorites_api; pub mod files_api; pub mod friends_api; diff --git a/src/models/inline_response_404.rs b/src/models/inline_response_404.rs deleted file mode 100644 index bc9a1ad..0000000 --- a/src/models/inline_response_404.rs +++ /dev/null @@ -1,26 +0,0 @@ -/* - * VRChat API Documentation - * - * - * Contact: me@ruby.js.org - * Generated by: https://openapi-generator.tech - */ - - - - -#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] -pub struct InlineResponse404 { - #[serde(rename = "error")] - pub error: Box, -} - -impl InlineResponse404 { - pub fn new(error: crate::models::Error) -> InlineResponse404 { - InlineResponse404 { - error: Box::new(error), - } - } -} - - diff --git a/src/models/license.rs b/src/models/license.rs new file mode 100644 index 0000000..dc032f0 --- /dev/null +++ b/src/models/license.rs @@ -0,0 +1,36 @@ +/* + * VRChat API Documentation + * + * + * Contact: me@ruby.js.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct License { + /// Either a AvatarID, LicenseGroupID, PermissionID or ProductID. This depends on the `forType` field. + #[serde(rename = "forId")] + pub for_id: String, + #[serde(rename = "forType")] + pub for_type: crate::models::LicenseType, + #[serde(rename = "forName")] + pub for_name: String, + #[serde(rename = "forAction")] + pub for_action: crate::models::LicenseAction, +} + +impl License { + pub fn new(for_id: String, for_type: crate::models::LicenseType, for_name: String, for_action: crate::models::LicenseAction) -> License { + License { + for_id, + for_type, + for_name, + for_action, + } + } +} + + diff --git a/src/models/license_action.rs b/src/models/license_action.rs new file mode 100644 index 0000000..2be94d6 --- /dev/null +++ b/src/models/license_action.rs @@ -0,0 +1,37 @@ +/* + * VRChat API Documentation + * + * + * Contact: me@ruby.js.org + * Generated by: https://openapi-generator.tech + */ + + +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum LicenseAction { + #[serde(rename = "wear")] + Wear, + #[serde(rename = "have")] + Have, + +} + +impl ToString for LicenseAction { + fn to_string(&self) -> String { + match self { + Self::Wear => String::from("wear"), + Self::Have => String::from("have"), + } + } +} + +impl Default for LicenseAction { + fn default() -> LicenseAction { + Self::Wear + } +} + + + + diff --git a/src/models/license_group.rs b/src/models/license_group.rs new file mode 100644 index 0000000..f04d3a5 --- /dev/null +++ b/src/models/license_group.rs @@ -0,0 +1,35 @@ +/* + * VRChat API Documentation + * + * + * Contact: me@ruby.js.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct LicenseGroup { + #[serde(rename = "id")] + pub id: String, + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "description")] + pub description: String, + #[serde(rename = "licenses")] + pub licenses: Vec, +} + +impl LicenseGroup { + pub fn new(id: String, name: String, description: String, licenses: Vec) -> LicenseGroup { + LicenseGroup { + id, + name, + description, + licenses, + } + } +} + + diff --git a/src/models/license_type.rs b/src/models/license_type.rs new file mode 100644 index 0000000..e055343 --- /dev/null +++ b/src/models/license_type.rs @@ -0,0 +1,43 @@ +/* + * VRChat API Documentation + * + * + * Contact: me@ruby.js.org + * Generated by: https://openapi-generator.tech + */ + + +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum LicenseType { + #[serde(rename = "avatar")] + Avatar, + #[serde(rename = "licenseGroup")] + LicenseGroup, + #[serde(rename = "permission")] + Permission, + #[serde(rename = "product")] + Product, + +} + +impl ToString for LicenseType { + fn to_string(&self) -> String { + match self { + Self::Avatar => String::from("avatar"), + Self::LicenseGroup => String::from("licenseGroup"), + Self::Permission => String::from("permission"), + Self::Product => String::from("product"), + } + } +} + +impl Default for LicenseType { + fn default() -> LicenseType { + Self::Avatar + } +} + + + + diff --git a/src/models/mod.rs b/src/models/mod.rs index e3d7cbf..1e4d5df 100644 --- a/src/models/mod.rs +++ b/src/models/mod.rs @@ -54,8 +54,6 @@ pub mod finish_file_data_upload_request; pub use self::finish_file_data_upload_request::FinishFileDataUploadRequest; pub mod friend_status; pub use self::friend_status::FriendStatus; -pub mod inline_response_404; -pub use self::inline_response_404::InlineResponse404; pub mod instance; pub use self::instance::Instance; pub mod instance_platforms; @@ -68,6 +66,14 @@ pub mod invite_request; pub use self::invite_request::InviteRequest; pub mod invite_response; pub use self::invite_response::InviteResponse; +pub mod license; +pub use self::license::License; +pub mod license_action; +pub use self::license_action::LicenseAction; +pub mod license_group; +pub use self::license_group::LicenseGroup; +pub mod license_type; +pub use self::license_type::LicenseType; pub mod limited_unity_package; pub use self::limited_unity_package::LimitedUnityPackage; pub mod limited_user; @@ -96,8 +102,22 @@ pub mod release_status; pub use self::release_status::ReleaseStatus; pub mod response; pub use self::response::Response; +pub mod subscription; +pub use self::subscription::Subscription; +pub mod subscription_period; +pub use self::subscription_period::SubscriptionPeriod; pub mod success; pub use self::success::Success; +pub mod transaction; +pub use self::transaction::Transaction; +pub mod transaction_agreement; +pub use self::transaction_agreement::TransactionAgreement; +pub mod transaction_status; +pub use self::transaction_status::TransactionStatus; +pub mod transaction_steam_info; +pub use self::transaction_steam_info::TransactionSteamInfo; +pub mod transaction_steam_wallet_info; +pub use self::transaction_steam_wallet_info::TransactionSteamWalletInfo; pub mod two_factor_auth_code; pub use self::two_factor_auth_code::TwoFactorAuthCode; pub mod unity_package; @@ -120,6 +140,8 @@ pub mod user_state; pub use self::user_state::UserState; pub mod user_status; pub use self::user_status::UserStatus; +pub mod user_subscription; +pub use self::user_subscription::UserSubscription; pub mod verify2_fa_result; pub use self::verify2_fa_result::Verify2FaResult; pub mod verify_auth_token_result; diff --git a/src/models/subscription.rs b/src/models/subscription.rs new file mode 100644 index 0000000..0c02642 --- /dev/null +++ b/src/models/subscription.rs @@ -0,0 +1,41 @@ +/* + * VRChat API Documentation + * + * + * Contact: me@ruby.js.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct Subscription { + #[serde(rename = "id")] + pub id: String, + #[serde(rename = "steamItemId")] + pub steam_item_id: String, + #[serde(rename = "amount")] + pub amount: f32, + #[serde(rename = "description")] + pub description: String, + #[serde(rename = "period")] + pub period: crate::models::SubscriptionPeriod, + #[serde(rename = "tier")] + pub tier: f32, +} + +impl Subscription { + pub fn new(id: String, steam_item_id: String, amount: f32, description: String, period: crate::models::SubscriptionPeriod, tier: f32) -> Subscription { + Subscription { + id, + steam_item_id, + amount, + description, + period, + tier, + } + } +} + + diff --git a/src/models/subscription_period.rs b/src/models/subscription_period.rs new file mode 100644 index 0000000..13200be --- /dev/null +++ b/src/models/subscription_period.rs @@ -0,0 +1,46 @@ +/* + * VRChat API Documentation + * + * + * Contact: me@ruby.js.org + * Generated by: https://openapi-generator.tech + */ + + +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum SubscriptionPeriod { + #[serde(rename = "hour")] + Hour, + #[serde(rename = "day")] + Day, + #[serde(rename = "week")] + Week, + #[serde(rename = "month")] + Month, + #[serde(rename = "year")] + Year, + +} + +impl ToString for SubscriptionPeriod { + fn to_string(&self) -> String { + match self { + Self::Hour => String::from("hour"), + Self::Day => String::from("day"), + Self::Week => String::from("week"), + Self::Month => String::from("month"), + Self::Year => String::from("year"), + } + } +} + +impl Default for SubscriptionPeriod { + fn default() -> SubscriptionPeriod { + Self::Hour + } +} + + + + diff --git a/src/models/transaction.rs b/src/models/transaction.rs new file mode 100644 index 0000000..a95e1ab --- /dev/null +++ b/src/models/transaction.rs @@ -0,0 +1,50 @@ +/* + * VRChat API Documentation + * + * + * Contact: me@ruby.js.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct Transaction { + #[serde(rename = "id")] + pub id: String, + #[serde(rename = "status")] + pub status: crate::models::TransactionStatus, + #[serde(rename = "subscription")] + pub subscription: Box, + #[serde(rename = "sandbox")] + pub sandbox: bool, + #[serde(rename = "created_at")] + pub created_at: String, + #[serde(rename = "updated_at")] + pub updated_at: String, + #[serde(rename = "steam", skip_serializing_if = "Option::is_none")] + pub steam: Option>, + #[serde(rename = "agreement", skip_serializing_if = "Option::is_none")] + pub agreement: Option>, + #[serde(rename = "error")] + pub error: String, +} + +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, + status, + subscription: Box::new(subscription), + sandbox, + created_at, + updated_at, + steam: None, + agreement: None, + error, + } + } +} + + diff --git a/src/models/transaction_agreement.rs b/src/models/transaction_agreement.rs new file mode 100644 index 0000000..24e6c0b --- /dev/null +++ b/src/models/transaction_agreement.rs @@ -0,0 +1,75 @@ +/* + * VRChat API Documentation + * + * + * Contact: me@ruby.js.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct TransactionAgreement { + #[serde(rename = "agreementId")] + pub agreement_id: String, + #[serde(rename = "itemId")] + pub item_id: f32, + /// This is NOT TransactionStatus, but whatever Steam return. + #[serde(rename = "status")] + pub status: String, + #[serde(rename = "period")] + pub period: String, + #[serde(rename = "frequency")] + pub frequency: f32, + #[serde(rename = "billingType")] + pub billing_type: String, + #[serde(rename = "startDate")] + pub start_date: String, + #[serde(rename = "endDate")] + pub end_date: String, + #[serde(rename = "recurringAmt")] + pub recurring_amt: f32, + #[serde(rename = "currency")] + pub currency: String, + #[serde(rename = "timeCreated")] + pub time_created: String, + #[serde(rename = "nextPayment")] + pub next_payment: String, + #[serde(rename = "lastPayment")] + pub last_payment: String, + #[serde(rename = "lastAmount")] + pub last_amount: f32, + #[serde(rename = "lastAmountVat")] + pub last_amount_vat: f32, + #[serde(rename = "outstanding")] + pub outstanding: f32, + #[serde(rename = "failedAttempts")] + pub failed_attempts: f32, +} + +impl TransactionAgreement { + pub fn new(agreement_id: String, item_id: f32, status: String, period: String, frequency: f32, billing_type: String, start_date: String, end_date: String, recurring_amt: f32, currency: String, time_created: String, next_payment: String, last_payment: String, last_amount: f32, last_amount_vat: f32, outstanding: f32, failed_attempts: f32) -> TransactionAgreement { + TransactionAgreement { + agreement_id, + item_id, + status, + period, + frequency, + billing_type, + start_date, + end_date, + recurring_amt, + currency, + time_created, + next_payment, + last_payment, + last_amount, + last_amount_vat, + outstanding, + failed_attempts, + } + } +} + + diff --git a/src/models/transaction_status.rs b/src/models/transaction_status.rs new file mode 100644 index 0000000..f002c5b --- /dev/null +++ b/src/models/transaction_status.rs @@ -0,0 +1,43 @@ +/* + * VRChat API Documentation + * + * + * Contact: me@ruby.js.org + * Generated by: https://openapi-generator.tech + */ + + +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum TransactionStatus { + #[serde(rename = "active")] + Active, + #[serde(rename = "failed")] + Failed, + #[serde(rename = "expired")] + Expired, + #[serde(rename = "chargeback")] + Chargeback, + +} + +impl ToString for TransactionStatus { + fn to_string(&self) -> String { + match self { + Self::Active => String::from("active"), + Self::Failed => String::from("failed"), + Self::Expired => String::from("expired"), + Self::Chargeback => String::from("chargeback"), + } + } +} + +impl Default for TransactionStatus { + fn default() -> TransactionStatus { + Self::Active + } +} + + + + diff --git a/src/models/transaction_steam_info.rs b/src/models/transaction_steam_info.rs new file mode 100644 index 0000000..a27cba4 --- /dev/null +++ b/src/models/transaction_steam_info.rs @@ -0,0 +1,42 @@ +/* + * VRChat API Documentation + * + * + * Contact: me@ruby.js.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct TransactionSteamInfo { + #[serde(rename = "walletInfo")] + pub wallet_info: Box, + /// Steam User ID + #[serde(rename = "steamId")] + pub steam_id: String, + /// Steam Order ID + #[serde(rename = "orderId")] + pub order_id: String, + /// Empty + #[serde(rename = "steamUrl")] + pub steam_url: String, + /// Steam Transaction ID, NOT the same as VRChat TransactionID + #[serde(rename = "transId")] + pub trans_id: String, +} + +impl TransactionSteamInfo { + pub fn new(wallet_info: crate::models::TransactionSteamWalletInfo, steam_id: String, order_id: String, steam_url: String, trans_id: String) -> TransactionSteamInfo { + TransactionSteamInfo { + wallet_info: Box::new(wallet_info), + steam_id, + order_id, + steam_url, + trans_id, + } + } +} + + diff --git a/src/models/transaction_steam_wallet_info.rs b/src/models/transaction_steam_wallet_info.rs new file mode 100644 index 0000000..e6aebfd --- /dev/null +++ b/src/models/transaction_steam_wallet_info.rs @@ -0,0 +1,35 @@ +/* + * VRChat API Documentation + * + * + * Contact: me@ruby.js.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct TransactionSteamWalletInfo { + #[serde(rename = "state")] + pub state: String, + #[serde(rename = "country")] + pub country: String, + #[serde(rename = "currency")] + pub currency: String, + #[serde(rename = "status")] + pub status: String, +} + +impl TransactionSteamWalletInfo { + pub fn new(state: String, country: String, currency: String, status: String) -> TransactionSteamWalletInfo { + TransactionSteamWalletInfo { + state, + country, + currency, + status, + } + } +} + + diff --git a/src/models/user_subscription.rs b/src/models/user_subscription.rs new file mode 100644 index 0000000..ff95c63 --- /dev/null +++ b/src/models/user_subscription.rs @@ -0,0 +1,69 @@ +/* + * VRChat API Documentation + * + * + * Contact: me@ruby.js.org + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct UserSubscription { + #[serde(rename = "id")] + pub id: String, + #[serde(rename = "transactionId")] + pub transaction_id: String, + /// Which \"Store\" it came from. Right now only Stores are \"Steam\" and \"Admin\". + #[serde(rename = "store")] + pub store: String, + #[serde(rename = "steamItemId", skip_serializing_if = "Option::is_none")] + pub steam_item_id: Option, + #[serde(rename = "amount")] + pub amount: f32, + #[serde(rename = "description")] + pub description: String, + #[serde(rename = "period")] + pub period: crate::models::SubscriptionPeriod, + #[serde(rename = "tier")] + pub tier: f32, + #[serde(rename = "active")] + pub active: bool, + #[serde(rename = "status")] + pub status: crate::models::TransactionStatus, + #[serde(rename = "expires")] + pub expires: String, + #[serde(rename = "created_at")] + pub created_at: String, + #[serde(rename = "updated_at")] + pub updated_at: String, + #[serde(rename = "licenseGroups")] + pub license_groups: Vec, + #[serde(rename = "isGift")] + pub is_gift: bool, +} + +impl UserSubscription { + pub fn new(id: String, transaction_id: String, store: String, amount: f32, description: String, period: crate::models::SubscriptionPeriod, tier: f32, active: bool, status: crate::models::TransactionStatus, expires: String, created_at: String, updated_at: String, license_groups: Vec, is_gift: bool) -> UserSubscription { + UserSubscription { + id, + transaction_id, + store, + steam_item_id: None, + amount, + description, + period, + tier, + active, + status, + expires, + created_at, + updated_at, + license_groups, + is_gift, + } + } +} + +