diff --git a/Doc/documentation.html b/Doc/documentation.html index 2834255d..6c26f6fc 100644 --- a/Doc/documentation.html +++ b/Doc/documentation.html @@ -822,8 +822,10 @@

mod.io UE4 Plugin Documentation

  • Query System Installations
  • UnsubscribeFromModAsync
  • SubscribeToModAsync
  • +
  • SubmitModRatingAsync
  • ShutdownAsync
  • RequestEmailAuthCodeAsync
  • +
  • ReportContentAsync
  • QueryUserProfile
  • QueryCurrentModUpdate
  • ListAllModsAsync
  • @@ -883,6 +885,7 @@

    mod.io UE4 Plugin Documentation

  • ModioModCollectionEntry
  • ModioOptionalModProgressInfo
  • ModioModProgressInfo
  • +
  • ModioReportParams
  • ModioTerms
  • ModioLink
  • ModioTestFilterParamData
  • @@ -942,6 +945,8 @@

    mod.io UE4 Plugin Documentation

  • EModioSortFieldType
  • EModioImageState
  • EModioModState
  • +
  • EModioRating
  • +
  • EModioReportType
  • EFileSizeUnit
  • @@ -1975,6 +1980,87 @@
    Parameters

    +

    SubmitModRatingAsync

    +
    +
    +nd img K2 SubmitModRatingAsync +
    +
    +
    +
    +
    void K2_SubmitModRatingAsync(FModioModID Mod, EModioRating Rating, FOnErrorOnlyDelegate Callback)
    +
    +
    +
    +

    Submits a rating for a mod on behalf of the current user. Submit a neutral rating to effectively clear a rating already submitted by a user. Submitting other values will overwrite any existing rating submitted by this user.

    +
    +
    Requirements
    +
    + +
    +
    Parameters
    + ++++ + + + + + + + + + + + + + + + + + + +

    Target

    Modio Subsystem Object Reference

    Mod

    The mod the user is rating

    Rating

    The rating the user wishes to submit

    Callback

    +
    Error Values
    + ++++ + + + + + + + + + + + + + + + + + + +

    GenericError::SDKNotInitialized

    SDK not initialized

    UserDataError::InvalidUser

    No authenticated user

    NetworkError

    Couldn’t connect to mod.io servers

    EntityNotFoundError

    Specified mod could not be found

    +
    +
    +

    ShutdownAsync

    @@ -1989,7 +2075,7 @@

    ShutdownAsync

    Cancels any running internal operations, frees SDK resources, and invokes any pending callbacks with Modio::GenericError::OperationCanceled . This function will NOT block while the deinitialization occurs.

    -
    Parameters
    +
    Parameters
    @@ -2023,7 +2109,7 @@

    RequestEmailAuthCodeAsync

    Begins email authentication for the current session by requesting a one-time code be sent to the specified email address if it is associated with a Mod.io account

    -
    Requirements
    +
    Requirements
    • @@ -2037,7 +2123,7 @@
      Requirements
    -
    Parameters
    +
    Parameters
    @@ -2058,7 +2144,7 @@
    Parameters
    -
    Error Values
    +
    Error Values
    @@ -2082,6 +2168,69 @@
    Error Values

    +

    ReportContentAsync

    +
    +
    +nd img K2 ReportContentAsync +
    +
    +
    +
    +
    void K2_ReportContentAsync(FModioReportParams Report, FOnErrorOnlyDelegate Callback)
    +
    +
    +
    +

    Sends a content report to mod.io. When using this function, please inform your users that if they provide their contact name or details in the Report parameter, that those may be shared with the person responsible for the content being reported. For more information on what data in a report will be shared with whom, please see our website’s report form for more information.

    +
    +
    Requirements
    +
    +
      +
    • +

      initialized-sdk

      +
    • +
    +
    +
    Parameters
    +
    ++++ + + + + + + + + + + + + + + +

    Target

    Modio Subsystem Object Reference

    Report

    Information about the content being reported and a description of the report.

    Callback

    Callback providing a status code to indicate successful submission of the report.

    +
    Error Values
    + ++++ + + + + + + + + + + +

    NetworkError

    Couldn’t Connect to mod.io servers

    InvalidArgsError

    Required information in the report did not pass validation

    +
    +
    +

    QueryUserProfile

    @@ -2096,7 +2245,7 @@

    QueryUserProfile

    Fetches the currently authenticated Mod.io user profile if there is one associated with the current platform user

    -
    Parameters
    +
    Parameters
    @@ -2134,7 +2283,7 @@

    QueryCurrentModUpdate

    Provides progress information for a mod installation or update operation if one is currently in progress.

    -
    Parameters
    +
    Parameters
    @@ -2172,7 +2321,7 @@

    ListAllModsAsync

    Provides a list of mods for the current game, that match the parameters specified in the filter

    -
    Requirements
    +
    Requirements
    • @@ -2183,7 +2332,7 @@
      Requirements
    -
    Parameters
    +
    Parameters
    @@ -2204,7 +2353,7 @@
    Parameters
    -
    Error Values
    +
    Error Values
    @@ -2238,7 +2387,7 @@

    InitializeAsync

    Initializes the SDK for the given user. Loads the state of mods installed on the system as well as the set of mods the specified user has installed on this device

    -
    Parameters
    +
    Parameters
    @@ -2276,7 +2425,7 @@

    GetUserMediaAsync (Avatar)

    Downloads the avatar of the currently authenticated user. Will only perform a download if there is no local cache of the avatar or if that cached copy is out-of-date.

    -
    Requirements
    +
    Requirements
    • @@ -2290,7 +2439,7 @@
      Requirements
    -
    Parameters
    +
    Parameters
    @@ -2311,7 +2460,7 @@
    Parameters
    -
    Error Values
    +
    Error Values
    @@ -2349,7 +2498,7 @@

    GetTermsOfUseAsync

    This function retrieves the information required for a game to display the mod.io terms of use to a player who wishes to create a mod.io account

    -
    Requirements
    +
    Requirements
    • @@ -2357,7 +2506,7 @@
      Requirements
    -
    Parameters
    +
    Parameters
    @@ -2382,7 +2531,7 @@
    Parameters
    -
    Error Values
    +
    Error Values
    @@ -2416,7 +2565,7 @@

    GetModTagOptionsAsync

    Fetches the available tags used on mods for the current game. These tags can them be used in conjunction with the FilterParams passed to ListAllMods Will be cached when first received

    -
    Requirements
    +
    Requirements
    • @@ -2427,7 +2576,7 @@
      Requirements
    -
    Parameters
    +
    Parameters
    @@ -2444,7 +2593,7 @@
    Parameters
    -
    Error Values
    +
    Error Values
    @@ -2478,7 +2627,7 @@

    GetModMediaAsync (Logo)

    Downloads the logo for the specified mod. Will use existing file if it is already present on disk

    -
    Requirements
    +
    Requirements
    • @@ -2489,7 +2638,7 @@
      Requirements
    -
    Parameters
    +
    Parameters
    @@ -2514,7 +2663,7 @@
    Parameters
    -
    Error Values
    +
    Error Values
    @@ -2556,7 +2705,7 @@

    GetModMediaAsync (Gallery Image)

    Get a gallery image for the specified mod ID. If it already exists on disk the file will be reused unless it is outdated

    -
    Requirements
    +
    Requirements
    • @@ -2567,7 +2716,7 @@
      Requirements
    -
    Parameters
    +
    Parameters
    @@ -2596,7 +2745,7 @@
    Parameters
    -
    Error Values
    +
    Error Values
    @@ -2638,7 +2787,7 @@

    GetModMediaAsync (Avatar)

    Downloads the creator avatar for a specified mod. Will use existing file if it is already present on disk and not outdated

    -
    Requirements
    +
    Requirements
    • @@ -2649,7 +2798,7 @@
      Requirements
    -
    Parameters
    +
    Parameters
    @@ -2674,7 +2823,7 @@
    Parameters
    -
    Error Values
    +
    Error Values
    @@ -2716,7 +2865,7 @@

    GetModInfoAsync

    Fetches detailed information about the specified mod, including description and file metadata for the most recent release

    -
    Requirements
    +
    Requirements
    • @@ -2727,7 +2876,7 @@
      Requirements
    -
    Parameters
    +
    Parameters
    @@ -2748,7 +2897,7 @@
    Parameters
    -
    Error Values
    +
    Error Values
    @@ -2786,7 +2935,7 @@

    FetchExternalUpdatesAsync

    Synchronises the local list of the current user’s subscribed mods with the server. Any mods that have been externally subscribed will be automatically marked for installation, and mods that have been externally removed from the user’s subscriptions may be uninstalled if no other local users have a current subscription.

    -
    Parameters
    +
    Parameters
    @@ -2820,7 +2969,7 @@

    EnableModManagement

    Enables the automatic management of installed mods on the system based on the user’s subscriptions.

    -
    Parameters
    +
    Parameters
    @@ -2854,7 +3003,7 @@

    ClearUserDataAsync

    De-authenticates the current Mod.io user for the current session, and clears all user-specific data stored on the current device. Any subscribed mods that are installed but do not have other local users subscribed will be uninstalled

    -
    Requirements
    +
    Requirements
    • @@ -2868,7 +3017,7 @@
      Requirements
    -
    Parameters
    +
    Parameters
    @@ -2885,7 +3034,7 @@
    Parameters
    -
    Error Values
    +
    Error Values
    @@ -2919,7 +3068,7 @@

    AuthenticateUserExternalAsync

    Uses platform-specific authentication to associate a Mod.io user account with the current platform user

    -
    Requirements
    +
    Requirements
    • @@ -2933,7 +3082,7 @@
      Requirements
    -
    Parameters
    +
    Parameters
    @@ -2958,7 +3107,7 @@
    Parameters
    -
    Error Values
    +
    Error Values
    @@ -2996,7 +3145,7 @@

    AuthenticateUserEmailAsync

    Completes email authentication for the current session by submitting the one-time code sent to the user’s email address

    -
    Requirements
    +
    Requirements
    • @@ -3010,7 +3159,7 @@
      Requirements
    -
    Parameters
    +
    Parameters
    @@ -3031,7 +3180,7 @@
    Parameters
    -
    Error Values
    +
    Error Values
    @@ -3069,7 +3218,7 @@

    Is Mod Management Busy

    Checks if the automatic management process is currently installing or removing mods

    -
    Parameters
    +
    Parameters
    @@ -3107,7 +3256,7 @@

    Get Last Validation Error

    If the last request to the mod.io servers returned a validation failure, this function returns extended information describing the fields that failed validation.

    -
    Requirements
    +
    Requirements
    • @@ -3115,7 +3264,7 @@
      Requirements
    -
    Parameters
    +
    Parameters
    @@ -3153,7 +3302,7 @@

    ForceUninstallModAsync

    Forcibly uninstalls a mod from the system. This is intended for use when a host application requires more room for a mod that the user wants to install, and as such will return an error if the current user is subscribed to the mod. To remove a mod the current user is subscribed to, use UnsubscribeFromModAsync.

    -
    Parameters
    +
    Parameters
    @@ -3174,7 +3323,7 @@
    Parameters
    -
    Error Values
    +
    Error Values
    @@ -3212,7 +3361,7 @@

    Disable Mod Management

    Disables automatic installation or uninstallation of mods based on the user’s subscriptions. Allows currently processing installation to complete; will cancel any pending operations when called.

    -
    Parameters
    +
    Parameters
    @@ -3669,6 +3818,9 @@

    Variables

    ModioErrorCode

    +
    +

    wrapper around Modio::ErrorCode

    +

    @@ -3824,12 +3976,12 @@

    Variables

    - + - + @@ -3900,6 +4052,10 @@

    Variables


    +

    ModioReportParams

    +
    +
    +

    ModioTerms

    This struct contains strings that should be displayed to a user when displaying the terms of use and offering to create a mod.io account

    @@ -4030,7 +4186,7 @@

    Set Portal

    Changes the portal for the provided set of initialization options

    -

    Parameters

    +

    Parameters

    FModioGameID

    GameID

    GameId

    The Mod.io-provided ID for the game

    FModioApiKey

    APIKey

    ApiKey

    The Mod.io-provided API key for your application or game

    @@ -4072,7 +4228,7 @@

    Make Initialize Options

    Make initialization options, should only be used in conjunction with InitializeAsync

    -

    Parameters

    +

    Parameters

    @@ -4118,7 +4274,7 @@

    Make Game Id

    Create a game id from a integer, should only be used in conjunction with InitializeAsync

    -

    Parameters

    +

    Parameters

    @@ -4152,7 +4308,7 @@

    Make Auth Params

    Creates an AuthenticationParams object

    -

    Parameters

    +

    Parameters

    @@ -4198,7 +4354,7 @@

    Make Api Key

    Create a ApiKey id from a string, should only be used in conjunction with InitializeAsync

    -

    Parameters

    +

    Parameters

    @@ -4229,7 +4385,7 @@

    Get Value

    int32 GetValue(FModioErrorCode Error)
    -

    Parameters

    +

    Parameters

    @@ -4264,7 +4420,7 @@

    Get Message

    FString GetMessage(FModioErrorCode Error)
    -

    Parameters

    +

    Parameters

    @@ -4299,7 +4455,7 @@

    Error Code Matches

    Checks if the passed-in ErrorCode matches the specified error condition

    -

    Parameters

    +

    Parameters

    @@ -4341,7 +4497,7 @@

    List User Subscription Async

    Runs a filter over the user’s subscription list

    -

    Parameters

    +

    Parameters

    @@ -4456,7 +4612,7 @@

    Get Logo Size

    FVector2D GetLogoSize(UTexture* Logo, EModioLogoSize LogoSize)
    -

    Parameters

    +

    Parameters

    @@ -4495,7 +4651,7 @@

    Get Gallery Size

    FVector2D GetGallerySize(UTexture* GalleryImage, EModioGallerySize GallerySize)
    -

    Parameters

    +

    Parameters

    @@ -4534,7 +4690,7 @@

    Get Avatar Size

    FVector2D GetAvatarSize(UTexture* Avatar, EModioAvatarSize AvatarSize)
    -

    Parameters

    +

    Parameters

    @@ -4573,7 +4729,7 @@

    Get Path

    FString GetPath(FModioModCollectionEntry Entry)
    -

    Parameters

    +

    Parameters

    @@ -4608,7 +4764,7 @@

    Get Mod State

    EModioModState GetModState(FModioModCollectionEntry Entry)
    -

    Parameters

    +

    Parameters

    @@ -4643,7 +4799,7 @@

    Get Mod Profile

    FModioModInfo GetModProfile(FModioModCollectionEntry Entry)
    -

    Parameters

    +

    Parameters

    @@ -4678,7 +4834,7 @@

    Get ID

    FModioModID GetID(FModioModCollectionEntry Entry)
    -

    Parameters

    +

    Parameters

    @@ -4716,7 +4872,7 @@

    Get Percent (integer64/integer64)

    Dividend/Divisor and return the floating point result with no checks *

    -

    Parameters

    +

    Parameters

    @@ -4751,7 +4907,7 @@

    Is Valid Security Code Format

    bool IsValidSecurityCodeFormat(FString String)
    -

    Parameters

    +

    Parameters

    @@ -4786,7 +4942,7 @@

    Is Valid Email Address Format

    bool IsValidEmailAddressFormat(FString String)
    -

    Parameters

    +

    Parameters

    @@ -4877,7 +5033,7 @@

    ToString (Filesize)

    FText Filesize_ToString(int64 FileSize, int32 MaxDecimals, TEnumAsByte<EFileSizeUnit> Unit)
    -

    Parameters

    +

    Parameters

    @@ -5355,6 +5511,10 @@

    Values

    + + + +

    UserTermsOfUseError

    When this condition is true, the error code indicates that the user has not yet accepted the mod.io Terms of Use.

    SubmitReportError

    When this condition is true, the error code indicates that a report for the specified content could not be submitted.


    @@ -5493,7 +5653,7 @@

    Values


    -

    EFileSizeUnit

    +

    EModioRating

    Values

    @@ -5502,6 +5662,76 @@

    Values

    + + + + + + + + + + + + +

    Neutral

    Positive

    Negative

    +
    +
    +
    +

    EModioReportType

    +

    Values

    + ++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    Generic

    DMCA

    NotWorking

    RudeContent

    IllegalContent

    StolenContent

    FalseInformation

    Other

    +
    +
    +
    +

    EFileSizeUnit

    +

    Values

    + ++++ + + @@ -5529,7 +5759,7 @@

    Values

    diff --git a/Doc/img/nd_img_DisableModManagement.png b/Doc/img/nd_img_DisableModManagement.png index 871ccb5c..312725be 100644 Binary files a/Doc/img/nd_img_DisableModManagement.png and b/Doc/img/nd_img_DisableModManagement.png differ diff --git a/Doc/img/nd_img_GetLogoFullSize.png b/Doc/img/nd_img_GetLogoFullSize.png index 58cada6a..4e19f828 100644 Binary files a/Doc/img/nd_img_GetLogoFullSize.png and b/Doc/img/nd_img_GetLogoFullSize.png differ diff --git a/Doc/img/nd_img_GetLogoThumbnailSize.png b/Doc/img/nd_img_GetLogoThumbnailSize.png index 40d14e98..94b400fa 100644 Binary files a/Doc/img/nd_img_GetLogoThumbnailSize.png and b/Doc/img/nd_img_GetLogoThumbnailSize.png differ diff --git a/Doc/img/nd_img_GetProjectEnvironment.png b/Doc/img/nd_img_GetProjectEnvironment.png index de731e12..8c2f38f6 100644 Binary files a/Doc/img/nd_img_GetProjectEnvironment.png and b/Doc/img/nd_img_GetProjectEnvironment.png differ diff --git a/Doc/img/nd_img_IsModManagementBusy.png b/Doc/img/nd_img_IsModManagementBusy.png index da7ea026..ee27ef2c 100644 Binary files a/Doc/img/nd_img_IsModManagementBusy.png and b/Doc/img/nd_img_IsModManagementBusy.png differ diff --git a/Doc/img/nd_img_K2_GetModTagOptionsAsync.png b/Doc/img/nd_img_K2_GetModTagOptionsAsync.png index 376495a4..86eb6a54 100644 Binary files a/Doc/img/nd_img_K2_GetModTagOptionsAsync.png and b/Doc/img/nd_img_K2_GetModTagOptionsAsync.png differ diff --git a/Doc/img/nd_img_K2_ReportContentAsync.png b/Doc/img/nd_img_K2_ReportContentAsync.png new file mode 100644 index 00000000..b23f692b Binary files /dev/null and b/Doc/img/nd_img_K2_ReportContentAsync.png differ diff --git a/Doc/img/nd_img_K2_SubmitModRatingAsync.png b/Doc/img/nd_img_K2_SubmitModRatingAsync.png new file mode 100644 index 00000000..17d242fc Binary files /dev/null and b/Doc/img/nd_img_K2_SubmitModRatingAsync.png differ diff --git a/Doc/img/nd_img_K2_UnsubscribeFromModAsync.png b/Doc/img/nd_img_K2_UnsubscribeFromModAsync.png index 2c861ae0..4e66ab0f 100644 Binary files a/Doc/img/nd_img_K2_UnsubscribeFromModAsync.png and b/Doc/img/nd_img_K2_UnsubscribeFromModAsync.png differ diff --git a/Doc/img/nd_img_ListUserSubscriptionAsync.png b/Doc/img/nd_img_ListUserSubscriptionAsync.png index 988366cf..8a28c90a 100644 Binary files a/Doc/img/nd_img_ListUserSubscriptionAsync.png and b/Doc/img/nd_img_ListUserSubscriptionAsync.png differ diff --git a/Doc/img/nd_img_MakeApiKey.png b/Doc/img/nd_img_MakeApiKey.png index 5e6ad782..1f1526a5 100644 Binary files a/Doc/img/nd_img_MakeApiKey.png and b/Doc/img/nd_img_MakeApiKey.png differ diff --git a/Doc/img/nd_img_MakeAuthParams.png b/Doc/img/nd_img_MakeAuthParams.png index 20cec3b9..5487d46d 100644 Binary files a/Doc/img/nd_img_MakeAuthParams.png and b/Doc/img/nd_img_MakeAuthParams.png differ diff --git a/Doc/img/nd_img_QueryUserInstallations.png b/Doc/img/nd_img_QueryUserInstallations.png index 5e64b74a..aa05f6d1 100644 Binary files a/Doc/img/nd_img_QueryUserInstallations.png and b/Doc/img/nd_img_QueryUserInstallations.png differ diff --git a/README.adoc b/README.adoc index a9fed87e..c38a6660 100644 --- a/README.adoc +++ b/README.adoc @@ -7,7 +7,7 @@ image:https://img.shields.io/badge/license-MIT-brightgreen.svg[alt="License", li image:https://img.shields.io/discord/389039439487434752.svg?label=Discord&logo=discord&color=7289DA&labelColor=2C2F33[alt="Discord", link="https://discord.mod.io"] image:https://img.shields.io/badge/Unreal-4.25%2B-dea309[alt="Unreal", link="https://www.unrealengine.com"] -Welcome to the mod.io UE4 plugin public repository. It allows game developers to host and automatically install user-created mods in their games. It provides a C++ and Blueprint interface around the mod.io SDK, which connects to the https://docs.mod.io[mod.io REST API]. We have a https://test.mod.io[test environment] available, and developers can create a game profile there to evaluate the plugin with. +Welcome to the mod.io UE4 plugin public repository. It allows game developers to host and automatically install user-created mods in their games which use UE 4.25 or newer. It provides a C++ and Blueprint interface around the mod.io SDK, which connects to the https://docs.mod.io[mod.io REST API]. We have a https://test.mod.io[test environment] available, and developers can create a game profile there to evaluate the plugin with. ++++ @@ -56,7 +56,7 @@ The settings have the following parameters: [.stretch,stripes=odd,frame=none, cols="25%,~"] |=== |[.paramname]#Game Id#|Your mod.io-provided Game Id for the target environment (Live, or Test) -|[.paramname]#API Key#|Your mod.io-provided Game Id for the target environment (Live, or Test) +|[.paramname]#API Key#|Your mod.io-provided API key for the target environment (Live, or Test) |[.paramname]#Environment#|Are you targeting the production/live environment or the private/test environment? |[.paramname]#Log Level#|The default logging level to use. Messages with a lower log level will be silently discarded. |[.paramname]#Portal#|The default portal to use. This usually corresponds to the store your game will be being distributed through. diff --git a/Source/Modio/Classes/Types/ModioAuthenticationParams.h b/Source/Modio/Classes/Types/ModioAuthenticationParams.h deleted file mode 100644 index a5b571a7..00000000 --- a/Source/Modio/Classes/Types/ModioAuthenticationParams.h +++ /dev/null @@ -1,61 +0,0 @@ -#pragma once - -#include "ModioSDK.h" - -#include "Internal/ModioPrivateDefines.h" -#include "Containers/UnrealString.h" -#include "Misc/Optional.h" - -#include "ModioAuthenticationParams.generated.h" - -/** @brief Simple struct to encapsulate data passed to external authentication systems */ -UENUM(BlueprintType) -enum class EModioAuthenticationProvider : uint8 -{ - XboxLive, - Steam, - GoG, - Itch, - Switch, - Discord -}; - -/** @brief Simple struct to encapsulate data passed to external authentication systems */ -USTRUCT(BlueprintType) -struct FModioAuthenticationParams -{ - GENERATED_BODY(); - - operator Modio::AuthenticationParams() const; - UPROPERTY(BlueprintReadWrite, EditInstanceOnly) - FString AuthToken; - UPROPERTY(BlueprintReadWrite, EditInstanceOnly) - FString UserEmail; - UPROPERTY(BlueprintReadWrite, EditInstanceOnly) - bool bUserHasAcceptedTerms = false; -}; - -#pragma region ToModio implementation -MODIO_BEGIN_CONVERT_SWITCHES -FORCEINLINE Modio::AuthenticationProvider ToModio(EModioAuthenticationProvider Provider) -{ - switch (Provider) - { - case EModioAuthenticationProvider::XboxLive: - return Modio::AuthenticationProvider::XboxLive; - case EModioAuthenticationProvider::Steam: - return Modio::AuthenticationProvider::Steam; - case EModioAuthenticationProvider::GoG: - return Modio::AuthenticationProvider::GoG; - case EModioAuthenticationProvider::Itch: - return Modio::AuthenticationProvider::Itch; - case EModioAuthenticationProvider::Switch: - return Modio::AuthenticationProvider::Switch; - case EModioAuthenticationProvider::Discord: - return Modio::AuthenticationProvider::Discord; - } - - return Modio::AuthenticationProvider::Steam; -} -MODIO_END_CONVERT_SWITCHES -#pragma endregion diff --git a/Source/Modio/Classes/Types/ModioCommonTypes.h b/Source/Modio/Classes/Types/ModioCommonTypes.h deleted file mode 100644 index aecab3cd..00000000 --- a/Source/Modio/Classes/Types/ModioCommonTypes.h +++ /dev/null @@ -1,605 +0,0 @@ -#pragma once - -#include "Misc/Crc.h" -#include "Internal/ModioPrivateDefines.h" -#include "ModioSDK.h" -#include "Types/ModioAuthenticationParams.h" - -// clang-format off -#include "ModioCommonTypes.generated.h" -// clang-format on - -/** @brief Enum representing what environment your game is deployed in */ -UENUM(BlueprintType) -enum class EModioEnvironment : uint8 -{ - // Test/Private environment - Test, - // Live/Public environment - Live -}; - -/** @brief Enum representing the store or service your game is being distributed through */ -UENUM(BlueprintType) -enum class EModioPortal : uint8 -{ - None, - Apple, - EpicGamesStore, - GOG, - Google, - Itchio, - Nintendo, - PSN, - Steam, - XboxLive -}; - -/** @brief Enum representing mod logo sizes */ -UENUM(BlueprintType) -enum class EModioLogoSize : uint8 -{ - // Original Size - Original, - // 320x180px - Thumb320, - // 640x360px - Thumb640, - // 1280x720px - Thumb1280 -}; - -/** @brief Enum representing avatar image sizes */ -UENUM(BlueprintType) -enum class EModioAvatarSize : uint8 -{ - // Original Size - Original, - // 50x50px Thumbnail - Thumb50, - // 100x100px Thumbnail - Thumb100 -}; - -/** */ -UENUM(BlueprintType) -enum class EModioGallerySize : uint8 -{ - // Original Size - Original, - // 320x180px Thumbnail - Thumb320 -}; - -/** @brief Degree of severity for the log output */ -UENUM() -enum class EModioLogLevel : uint8 -{ - // Detailed low-level debugging output. Not intended for general use - Trace = 0, - // Informational output containing status messages - Info = 1, - // Warnings about incorrect plugin usage, timeouts - Warning = 2, - // Only errors - Error = 3 -}; - -/** @brief Enum representing the languages mod.io support responses in */ -UENUM(BlueprintType) -enum class EModioLanguage : uint8 -{ - English, - Bulgarian, - French, - German, - Italian, - Polish, - Portuguese, - Hungarian, - Japanese, - Korean, - Russian, - Spanish, - Thai, - ChineseSimplified, - ChineseTraditional -}; - -/** @brief Strong type for Mod IDs */ -USTRUCT(BlueprintType) -struct MODIO_API FModioModID -{ - GENERATED_BODY() - - FModioModID(); - constexpr explicit FModioModID(Modio::ModID InModId) : ModID(InModId) {} - - FORCEINLINE friend uint32 GetTypeHash(FModioModID ModioModId) - { - return FCrc::MemCrc32(&ModioModId.ModID, sizeof(Modio::ModID)); - } - - FORCEINLINE friend bool operator==(FModioModID A, FModioModID B) - { - return A.ModID == B.ModID; - } - - FORCEINLINE friend bool operator!=(FModioModID A, FModioModID B) - { - return A.ModID != B.ModID; - } - - FORCEINLINE friend bool operator<(FModioModID A, FModioModID B) - { - return A.ModID < B.ModID; - } - - FORCEINLINE friend bool operator>(FModioModID A, FModioModID B) - { - return A.ModID > B.ModID; - } - - /** Implicitly convert it to the underlying type */ - constexpr FORCEINLINE operator Modio::ModID() const - { - return ModID; - } - - FORCEINLINE FString ToString() const - { - if (ModID < 0) - { - return TEXT("InvalidModID"); - } - return FString::Printf(TEXT("%lld"), *ModID); - } - -private: - Modio::ModID ModID; -}; - -template<> -struct TStructOpsTypeTraits : public TStructOpsTypeTraitsBase2 -{ - enum - { - WithIdenticalViaEquality = true - }; -}; - -/** @brief Strong type for Game IDs */ -USTRUCT(BlueprintType, meta = (HasNativeMake = "Modio.ModioCommonTypesLibrary.MakeGameId")) -struct MODIO_API FModioGameID -{ - GENERATED_BODY() - - FModioGameID(); - constexpr explicit FModioGameID(Modio::GameID InGameId) : GameID(InGameId) {} - constexpr explicit FModioGameID(int64 InGameId) : GameID(Modio::GameID(InGameId)) {} - - FORCEINLINE friend uint32 GetTypeHash(FModioGameID ModioGameId) - { - return FCrc::MemCrc32(&ModioGameId.GameID, sizeof(Modio::GameID)); - } - - FORCEINLINE friend bool operator==(FModioGameID A, FModioGameID B) - { - return A.GameID == B.GameID; - } - - /** Implicitly convert it to the underlying type */ - constexpr FORCEINLINE operator Modio::GameID() const - { - return GameID; - } - - FORCEINLINE FString ToString() const - { - if (GameID < 0) - { - return TEXT("InvalidGameID"); - } - return FString::Printf(TEXT("%lld"), *GameID); - } - - static FORCEINLINE FModioGameID InvalidGameID() - { - return FModioGameID(Modio::GameID::InvalidGameID()); - } - -private: - Modio::GameID GameID; -}; - -template<> -struct TStructOpsTypeTraits : public TStructOpsTypeTraitsBase2 -{ - enum - { - WithIdenticalViaEquality = true - }; -}; - -/** @brief Strong type for File Metadata IDs */ -USTRUCT(BlueprintType) -struct MODIO_API FModioFileMetadataID -{ - GENERATED_BODY() - - FModioFileMetadataID(); - constexpr explicit FModioFileMetadataID(Modio::FileMetadataID InFileMetadataId) : FileMetadataID(InFileMetadataId) {} - - FORCEINLINE friend uint32 GetTypeHash(FModioFileMetadataID FileMetadataID) - { - return FCrc::MemCrc32(&FileMetadataID.FileMetadataID, sizeof(Modio::FileMetadataID)); - } - - FORCEINLINE friend bool operator==(FModioFileMetadataID A, FModioFileMetadataID B) - { - return A.FileMetadataID == B.FileMetadataID; - } - - /** Implicitly convert it to the underlying type */ - constexpr FORCEINLINE operator Modio::FileMetadataID() const - { - return FileMetadataID; - } - - FORCEINLINE FString ToString() const - { - if (FileMetadataID < 0) - { - return TEXT("InvalidFileMetadataID"); - } - return FString::Printf(TEXT("%lld"), *FileMetadataID); - } - -private: - Modio::FileMetadataID FileMetadataID; -}; - -template<> -struct TStructOpsTypeTraits : public TStructOpsTypeTraitsBase2 -{ - enum - { - WithIdenticalViaEquality = true - }; -}; - -/** @brief Strong type for User IDs */ -USTRUCT(BlueprintType) -struct MODIO_API FModioUserID -{ - GENERATED_BODY() - - FModioUserID(); - constexpr explicit FModioUserID(Modio::UserID InUserID) : UserID(InUserID) {} - constexpr explicit FModioUserID(int64 InUserID) : UserID(Modio::UserID(InUserID)) {} - - FORCEINLINE friend uint32 GetTypeHash(FModioUserID UserID) - { - return FCrc::MemCrc32(&UserID.UserID, sizeof(Modio::UserID)); - } - - FORCEINLINE friend bool operator==(FModioUserID A, FModioUserID B) - { - return A.UserID == B.UserID; - } - - /** Implicitly convert it to the underlying type */ - constexpr FORCEINLINE operator Modio::UserID() const - { - return UserID; - } - - FORCEINLINE FString ToString() const - { - if (UserID < 0) - { - return TEXT("InvalidUserID"); - } - return FString::Printf(TEXT("%lld"), *UserID); - } - -private: - Modio::UserID UserID; -}; - -template<> -struct TStructOpsTypeTraits : public TStructOpsTypeTraitsBase2 -{ - enum - { - WithIdenticalViaEquality = true - }; -}; - -/** @brief Strong type for Api Keys */ -USTRUCT(BlueprintType, meta = (HasNativeMake = "Modio.ModioCommonTypesLibrary.MakeApiKey")) -struct MODIO_API FModioApiKey -{ - GENERATED_BODY() - - FModioApiKey() = default; - explicit FModioApiKey(const FString& InApiKey); - explicit FModioApiKey(const Modio::ApiKey& InApiKey); - - /** Implicitly convert it to the underlying type */ - FORCEINLINE operator Modio::ApiKey() const - { - return Modio::ApiKey(TCHAR_TO_UTF8(*ToString())); - } - - FORCEINLINE const FString& ToString() const - { - // Put in the function instead of default constructor to avoid having to allocate memory for - // each empty instance - if (ApiKey.Len() == 0) - { - static FString Invalid(TEXT("InvalidApiKey")); - return Invalid; - } - return ApiKey; - } - - static FModioApiKey InvalidAPIKey() - { - return FModioApiKey(Modio::ApiKey::InvalidAPIKey()); - } - -private: - FString ApiKey; -}; - -/** @brief Strong type for email address */ -USTRUCT(BlueprintType) -struct MODIO_API FModioEmailAddress -{ - GENERATED_BODY() - - FModioEmailAddress() = default; - FModioEmailAddress(const FString& InEmailAddress); - - /** Implicitly convert it to the underlying type */ - FORCEINLINE operator Modio::EmailAddress() const - { - return Modio::EmailAddress(TCHAR_TO_UTF8(*ToString())); - } - - FORCEINLINE const FString& ToString() const - { - // Put in the function instead of default constructor to avoid having to allocate memory for - // each empty instance - if (EmailAddress.Len() == 0) - { - static FString Invalid(TEXT("InvalidEmailAddress")); - return Invalid; - } - return EmailAddress; - } - -private: - FString EmailAddress; -}; - -/** @brief Strong type for email auth code */ -USTRUCT(BlueprintType) -struct MODIO_API FModioEmailAuthCode -{ - GENERATED_BODY() - - FModioEmailAuthCode() = default; - FModioEmailAuthCode(const FString& InEmailAuthCode); - - /** Implicitly convert it to the underlying type */ - FORCEINLINE operator Modio::EmailAuthCode() const - { - return Modio::EmailAuthCode(TCHAR_TO_UTF8(*ToString())); - } - - FORCEINLINE const FString& ToString() const - { - // Put in the function instead of default constructor to avoid having to allocate memory for - // each empty instance - if (EmailAuthCode.Len() == 0) - { - static FString Invalid(TEXT("InvalidEmailAuthCode")); - return Invalid; - } - return EmailAuthCode; - } - -private: - FString EmailAuthCode; -}; - -FORCEINLINE FModioModID ToUnreal(Modio::ModID Value); -FORCEINLINE FModioFileMetadataID ToUnreal(Modio::FileMetadataID Value); - -FORCEINLINE Modio::LogLevel ToModio(EModioLogLevel UnrealLogLevel); -FORCEINLINE Modio::AvatarSize ToModio(EModioAvatarSize AvatarSize); -FORCEINLINE Modio::GallerySize ToModio(EModioGallerySize GallerySize); -FORCEINLINE Modio::LogoSize ToModio(EModioLogoSize LogoSize); -FORCEINLINE Modio::Environment ToModio(EModioEnvironment Environment); -FORCEINLINE Modio::Portal ToModio(EModioPortal Portal); - - -#pragma region ToModio implementation - -MODIO_BEGIN_CONVERT_SWITCHES - -Modio::LogLevel ToModio(EModioLogLevel UnrealLogLevel) -{ - switch (UnrealLogLevel) - { - case EModioLogLevel::Error: - return Modio::LogLevel::Error; - case EModioLogLevel::Info: - return Modio::LogLevel::Info; - case EModioLogLevel::Trace: - return Modio::LogLevel::Trace; - case EModioLogLevel::Warning: - return Modio::LogLevel::Warning; - } - - checkf(false, TEXT("Missed a case in ToModio(EModioLogLevel UnrealLogLevel)")); - return Modio::LogLevel::Info; -} - -Modio::AvatarSize ToModio(EModioAvatarSize AvatarSize) -{ - switch (AvatarSize) - { - case EModioAvatarSize::Original: - return Modio::AvatarSize::Original; - case EModioAvatarSize::Thumb50: - return Modio::AvatarSize::Thumb50; - case EModioAvatarSize::Thumb100: - return Modio::AvatarSize::Thumb100; - } - - checkf(false, TEXT("Missed a case in ToModio(EModioAvatarSize AvatarSize)")); - return Modio::AvatarSize::Thumb50; -} - -Modio::GallerySize ToModio(EModioGallerySize GallerySize) -{ - switch (GallerySize) - { - case EModioGallerySize::Original: - return Modio::GallerySize::Original; - case EModioGallerySize::Thumb320: - return Modio::GallerySize::Thumb320; - } - - checkf(false, TEXT("Missed a case in ToModio(EModioGallerySize GallerySize)")); - return Modio::GallerySize::Thumb320; -} - -Modio::LogoSize ToModio(EModioLogoSize LogoSize) -{ - switch (LogoSize) - { - case EModioLogoSize::Original: - return Modio::LogoSize::Original; - case EModioLogoSize::Thumb320: - return Modio::LogoSize::Thumb320; - case EModioLogoSize::Thumb640: - return Modio::LogoSize::Thumb640; - case EModioLogoSize::Thumb1280: - return Modio::LogoSize::Thumb1280; - } - - checkf(false, TEXT("Missed a case in ToModio(EModioLogoSize LogoSize)")); - return Modio::LogoSize::Thumb320; -} - -Modio::Environment ToModio(EModioEnvironment Environment) -{ - switch (Environment) - { - case EModioEnvironment::Test: - return Modio::Environment::Test; - case EModioEnvironment::Live: - return Modio::Environment::Live; - } - - checkf(false, TEXT("Missed a case in ToModio(EModioEnvironment Environment)")); - return Modio::Environment::Test; -} - -Modio::Portal ToModio(EModioPortal Portal) { - switch (Portal) - { - case EModioPortal::None: - return Modio::Portal::None; - break; - case EModioPortal::Apple: - return Modio::Portal::Apple; - break; - case EModioPortal::EpicGamesStore: - return Modio::Portal::EpicGamesStore; - break; - case EModioPortal::GOG: - return Modio::Portal::GOG; - break; - case EModioPortal::Google: - return Modio::Portal::Google; - break; - case EModioPortal::Itchio: - return Modio::Portal::Itchio; - break; - case EModioPortal::Nintendo: - return Modio::Portal::Nintendo; - break; - case EModioPortal::PSN: - return Modio::Portal::PSN; - break; - case EModioPortal::Steam: - return Modio::Portal::Steam; - break; - case EModioPortal::XboxLive: - return Modio::Portal::XboxLive; - break; - } - checkf(false, TEXT("Missed a case in ToModio(EModioPortal)")); - return Modio::Portal::None; -} - - -FORCEINLINE Modio::Language ToModio(EModioLanguage Language) -{ - switch (Language) - { - case EModioLanguage::English: - return Modio::Language::English; - case EModioLanguage::Bulgarian: - return Modio::Language::Bulgarian; - case EModioLanguage::French: - return Modio::Language::French; - case EModioLanguage::German: - return Modio::Language::German; - case EModioLanguage::Italian: - return Modio::Language::Italian; - case EModioLanguage::Polish: - return Modio::Language::Polish; - case EModioLanguage::Portuguese: - return Modio::Language::Portuguese; - case EModioLanguage::Hungarian: - return Modio::Language::Hungarian; - case EModioLanguage::Japanese: - return Modio::Language::Japanese; - case EModioLanguage::Korean: - return Modio::Language::Korean; - case EModioLanguage::Russian: - return Modio::Language::Russian; - case EModioLanguage::Spanish: - return Modio::Language::Spanish; - case EModioLanguage::Thai: - return Modio::Language::Thai; - case EModioLanguage::ChineseSimplified: - return Modio::Language::ChineseSimplified; - case EModioLanguage::ChineseTraditional: - return Modio::Language::ChineseTraditional; - } - - checkf(false, TEXT("Missed a case in ToModio(EModioLanguage Language)")); - return Modio::Language::English; -} - - -MODIO_END_CONVERT_SWITCHES - -FModioModID ToUnreal(Modio::ModID Value) -{ - return FModioModID(Value); -} - -FModioFileMetadataID ToUnreal(Modio::FileMetadataID Value) -{ - return FModioFileMetadataID(Value); -} - -#pragma endregion diff --git a/Source/Modio/Classes/Types/ModioErrorCode.h b/Source/Modio/Classes/Types/ModioErrorCode.h deleted file mode 100644 index 0106bc5f..00000000 --- a/Source/Modio/Classes/Types/ModioErrorCode.h +++ /dev/null @@ -1,47 +0,0 @@ -#pragma once - -#include "ModioSDK.h" - -// clang-format off -#include "ModioErrorCode.generated.h" -// clang-format on - -/** @bried wrapper around the Modio::ErrorCode. This is a wrapper around the std::error_code */ -USTRUCT(BlueprintType) -struct MODIO_API FModioErrorCode -{ - GENERATED_BODY() - - // This is to allow delegates to pass FModioErrorCode code, but I would have preferred it to be deleted - FModioErrorCode() = default; - FModioErrorCode(Modio::ErrorCode ec); - - /** return true if this error code is a error */ - FORCEINLINE operator bool() const - { - return Error.value() != 0; - } - - /** Get the error code */ - FORCEINLINE int GetValue() const - { - return Error.value(); - } - FORCEINLINE Modio::ErrorCode GetRawErrorCode() const - { - return Error; - } - - /** Get a human readable message from the error code */ - FString GetMessage() const; - -private: - Modio::ErrorCode Error; -}; - -#pragma region ToUnreal implementation -FORCEINLINE FModioErrorCode ToUnreal(Modio::ErrorCode ec) -{ - return FModioErrorCode(ec); -} -#pragma endregion diff --git a/Source/Modio/Classes/Types/ModioFilterParams.h b/Source/Modio/Classes/Types/ModioFilterParams.h deleted file mode 100644 index 36567883..00000000 --- a/Source/Modio/Classes/Types/ModioFilterParams.h +++ /dev/null @@ -1,260 +0,0 @@ -#pragma once - -#include "Internal/ModioConvert.h" -#include "Internal/ModioPrivateDefines.h" - -#include "ModioSDK.h" - -#include "Types/ModioCommonTypes.h" - -// clang-format off -#include "ModioFilterParams.generated.h" -// clang-format on - -/// @brief Enum indicating which field should be used to sort the results -UENUM(BlueprintType) -enum class EModioSortFieldType : uint8 -{ - ID, /** use mod ID (default) */ - DownloadsToday, /** use number of downloads in last 24 (exposed in REST API as 'popular' */ - SubscriberCount, /** use number of subscribers */ - Rating, /** use mod rating */ - DateMarkedLive, /** use date mod was marked live */ - DateUpdated /** use date mod was last updated */ -}; - -/// @brief Enum indicating which direction sorting should be applied -UENUM(BlueprintType) -enum class EModioSortDirection : uint8 -{ - Ascending, /** (default) */ - Descending -}; - -FORCEINLINE Modio::FilterParams::SortFieldType ToModio(EModioSortFieldType Field); -FORCEINLINE Modio::FilterParams::SortDirection ToModio(EModioSortDirection Direction); - -/** @brief Class storing a set of filter parameters for use in xref:ListAllModsAsync[] */ -USTRUCT(BlueprintType) -struct MODIO_API FModioFilterParams -{ - GENERATED_BODY() - - /** Convert to the underlying type for the modio functions */ - FORCEINLINE const Modio::FilterParams& operator*() const - { - return FilterParams; - } - - /** - * @brief Indicates the filter should only include the specified mods - * @param IDs the set of mods to match - * @return *this - */ - FModioFilterParams& MatchingIDs(const TArray& IDs) - { - std::vector Out; - for (FModioModID ID : IDs) - { - Out.push_back(ID); - } - - FilterParams.MatchingIDs(Out); - return *this; - } - - /** - * @brief Indicates the filter should exclude the specified mods. - * @param IDs the set of mods to exclude - * @return *this - */ - FModioFilterParams& ExcludingIDs(const TArray& IDs) - { - std::vector Out; - for (FModioModID ID : IDs) - { - Out.push_back(ID); - } - - FilterParams.ExcludingIDs(Out); - return *this; - } - - /** - * @brief Indicates results should be sorted using the specified field and direction - * @param ByField Field to sort with - * @param ByDirection Direction to sort - * @return *this - **/ - FORCEINLINE FModioFilterParams& SortBy(EModioSortFieldType ByField, EModioSortDirection ByDirection) - { - FilterParams.SortBy(ToModio(ByField), ToModio(ByDirection)); - return *this; - } - - /** - * @brief Only include mods where the name contains the provided string - * @param SearchString Search string - * @return *this - **/ - FORCEINLINE FModioFilterParams& NameContains(const FString& SearchString) - { - FilterParams.NameContains(ToSTD(SearchString)); - return *this; - } - - /** - * @brief Only include mods where the name contains at least one of the provided strings (string1 OR string2 OR - *stringN...) - * @tparam ...Args std::string - * @param SearchString First search string - * @param ...args Additional search strings - * @return *this - **/ - FORCEINLINE FModioFilterParams& NameContains(const TArray& SearchString) - { - FilterParams.NameContains(ToSTD(SearchString)); - return *this; - } - - /** - * @brief Only include mods that were marked live (i.e released) after the specified date - * @param LiveAfter Minimum date - * @return *this - **/ - FORCEINLINE FModioFilterParams& MarkedLiveAfter(FDateTime LiveAfter) - { - FilterParams.MarkedLiveAfter(ToSTD(LiveAfter)); - return *this; - } - - /** - * @brief Only include mods that were marked live (i.e released) before the specified date - * @param LiveBefore Maximum date - * @return *this - **/ - FORCEINLINE FModioFilterParams& MarkedLiveBefore(FDateTime LiveBefore) - { - FilterParams.MarkedLiveBefore(ToSTD(LiveBefore)); - return *this; - } - - /** - * @brief Only include mods that have the specified tag - * @param Tag Tag to include - * @return *this - **/ - FORCEINLINE FModioFilterParams& WithTags(const FString& Tag) - { - FilterParams.WithTags(ToSTD(Tag)); - return *this; - } - - /** - * @brief Only include mods that have all the specified tags (tag1 AND tag2 AND tagN...) - * @param NewTags The set of tags to filter on - * @return *this - **/ - FORCEINLINE FModioFilterParams& WithTags(const TArray& NewTags) - { - FilterParams.WithTags(ToSTD(NewTags)); - return *this; - } - - /** - * @brief Only include mods that do not have the specified tag - * @param Tag Tag to exclude - * @return *this - **/ - FORCEINLINE FModioFilterParams& WithoutTags(const FString& Tag) - { - FilterParams.WithoutTags(ToSTD(Tag)); - return *this; - } - - /** - * @brief Only include mods that do not have any of the specified tags ( NOT (tag1 OR tag2 OR tagN...)) - * @param NewTags Tags to exclude - * @return *this - **/ - FORCEINLINE FModioFilterParams& WithoutTags(const TArray& NewTags) - { - FilterParams.WithoutTags(ToSTD(NewTags)); - return *this; - } - - /** - * @brief Returns a sub-range of query results from StartIndex to StartIndex + ResultCount - * @param StartIndex Zero-based index of first result to return - * @param ResultCount Number of results to return - * @return *this - **/ - FORCEINLINE FModioFilterParams& IndexedResults(uint64 StartIndex, uint64 ResultCount) - { - FilterParams.IndexedResults(StartIndex, ResultCount); - return *this; - } - - /** - * @brief Returns a sub-range of query results based on a specified page size and index - * @param PageNumber Zero-based index of page to return - * @param PageSize Number of results in a page - * @return - **/ - FORCEINLINE FModioFilterParams& PagedResults(uint64 PageNumber, uint64 PageSize) - { - FilterParams.PagedResults(PageNumber, PageSize); - return *this; - } - - /** - * @brief Converts the filter params to a string suitable for use in the REST API. - * @note Performs a allocation to acquire the string - * @return FString containing the filter parameters - */ - FORCEINLINE FString ToString() const - { - return FString(UTF8_TO_TCHAR(FilterParams.ToString().c_str())); - } - -private: - Modio::FilterParams FilterParams; -}; - -#pragma region ToModio implementation -MODIO_BEGIN_CONVERT_SWITCHES -Modio::FilterParams::SortDirection ToModio(EModioSortDirection SortDirection) -{ - switch (SortDirection) - { - case EModioSortDirection::Ascending: - return Modio::FilterParams::SortDirection::Ascending; - case EModioSortDirection::Descending: - return Modio::FilterParams::SortDirection::Descending; - } - - return Modio::FilterParams::SortDirection::Ascending; -} - -Modio::FilterParams::SortFieldType ToModio(EModioSortFieldType Environment) -{ - switch (Environment) - { - case EModioSortFieldType::ID: - return Modio::FilterParams::SortFieldType::ID; - case EModioSortFieldType::DownloadsToday: - return Modio::FilterParams::SortFieldType::DownloadsToday; - case EModioSortFieldType::SubscriberCount: - return Modio::FilterParams::SortFieldType::SubscriberCount; - case EModioSortFieldType::Rating: - return Modio::FilterParams::SortFieldType::Rating; - case EModioSortFieldType::DateMarkedLive: - return Modio::FilterParams::SortFieldType::DateMarkedLive; - case EModioSortFieldType::DateUpdated: - return Modio::FilterParams::SortFieldType::DateUpdated; - } - - return Modio::FilterParams::SortFieldType::ID; -} -MODIO_END_CONVERT_SWITCHES -#pragma endregion \ No newline at end of file diff --git a/Source/Modio/Classes/Types/ModioImageState.h b/Source/Modio/Classes/Types/ModioImageState.h deleted file mode 100644 index 18a7d763..00000000 --- a/Source/Modio/Classes/Types/ModioImageState.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -// clang-format off -#include "ModioImageState.generated.h" -// clang-format on - -UENUM(BlueprintType) -enum class EModioImageState : uint8 -{ - OnDisc, - LoadingIntoMemory, - InMemory, - Corrupted -}; \ No newline at end of file diff --git a/Source/Modio/Classes/Types/ModioModCollectionEntry.h b/Source/Modio/Classes/Types/ModioModCollectionEntry.h deleted file mode 100644 index 45cba265..00000000 --- a/Source/Modio/Classes/Types/ModioModCollectionEntry.h +++ /dev/null @@ -1,89 +0,0 @@ -#pragma once - -#include "ModioSDK.h" -#include "Internal/ModioPrivateDefines.h" -#include "Types/ModioCommonTypes.h" -#include "Types/ModioModInfo.h" - -// clang-format off -#include "ModioModCollectionEntry.generated.h" -// clang-format on - -/// @brief Enum representing the current state of a mod -UENUM(BlueprintType) -enum class EModioModState : uint8 -{ - InstallationPending, // dont save - Installed, - UpdatePending, // saved as installed - Downloading, // installing - dont save - Extracting, // installing- don't save - UninstallPending, // saved as installed -}; - -// @todo: This could just copy the four members that you can access -/** @brief Class representing a mod which is installed locally */ -USTRUCT(BlueprintType) -struct MODIO_API FModioModCollectionEntry -{ - GENERATED_BODY() - - FModioModCollectionEntry() = default; - FModioModCollectionEntry(Modio::ModCollectionEntry&& ModCollectionEntry); - - /** @return Modio::ModState enum representing current state of the mod */ - EModioModState GetModState() const; - - /** @return Mod ID */ - FModioModID GetID() const; - - /** @return Modio::ModInfo containing mod profile data */ - const FModioModInfo& GetModProfile() const; - - /** - * @return Path to the mod's installation folder on disk - * NOTE: If the mod is not yet installed this path may not yet exist. Check - * @doc_xref{ModCollectionEntry::GetModState} before trying to load files in this location - **/ - const FString& GetPath() const; - -private: - Modio::ModCollectionEntry ModCollectionEntry; - - /** Lazy init path, that we will initialize when we request the path */ - mutable TOptional CachedPath; - - /** Lazy init mod info, that we will initialize when we request the path */ - mutable TOptional CachedModInfo; -}; - -#pragma region ToUnreal implementation -FORCEINLINE FModioModCollectionEntry ToUnreal(const FModioModCollectionEntry& ModCollectionEntry) -{ - return FModioModCollectionEntry(ModCollectionEntry); -} - -MODIO_BEGIN_CONVERT_SWITCHES -FORCEINLINE EModioModState ToUnreal(Modio::ModState ModState) -{ - switch (ModState) - { - case Modio::ModState::InstallationPending: - return EModioModState::InstallationPending; - case Modio::ModState::Installed: - return EModioModState::Installed; - case Modio::ModState::UpdatePending: - return EModioModState::UpdatePending; - case Modio::ModState::Downloading: - return EModioModState::Downloading; - case Modio::ModState::Extracting: - return EModioModState::Extracting; - case Modio::ModState::UninstallPending: - return EModioModState::UninstallPending; - } - - checkf(false, TEXT("Missed a case in ToUnreal(Modio::ModState ModState)")); - return EModioModState::InstallationPending; -} -MODIO_END_CONVERT_SWITCHES -#pragma endregion \ No newline at end of file diff --git a/Source/Modio/Classes/Types/ModioModManagementEvent.h b/Source/Modio/Classes/Types/ModioModManagementEvent.h deleted file mode 100644 index 2f3e70ea..00000000 --- a/Source/Modio/Classes/Types/ModioModManagementEvent.h +++ /dev/null @@ -1,67 +0,0 @@ -#pragma once - -#include "Internal/ModioPrivateDefines.h" -#include "Types/ModioCommonTypes.h" -#include "Types/ModioErrorCode.h" - -// clang-format off -#include "ModioModManagementEvent.generated.h" -// clang-format on - -/** @brief What type of event occurred */ -UENUM(BlueprintType) -enum class EModioModManagementEventType : uint8 -{ - Installed, /** Mod installation to local storage */ - Uninstalled, /** Mod uninstallation from local storage*/ - Updated /** Mod local installation updated to latest version*/ -}; - -/** @brief Simple struct representing the outcome of a mod management operation */ -USTRUCT(BlueprintType) -struct MODIO_API FModioModManagementEvent -{ - GENERATED_BODY() - - // This is to allow delegates to pass FModioModManagementEvent code, but I would have preferred it to be deleted - FModioModManagementEvent() = default; - FModioModManagementEvent(const Modio::ModManagementEvent& Event); - - /** @brief ID for the mod that the event occurred on */ - UPROPERTY(BlueprintReadOnly,Category="ModManagementEvent") - FModioModID ID; - - /** @brief What type of event occurred */ - UPROPERTY(BlueprintReadOnly,Category="ModManagementEvent") - EModioModManagementEventType Event; - - /** @brief Empty if operation completed successfully, truthy/contains error code if operation failed */ - UPROPERTY(BlueprintReadOnly,Category="ModManagementEvent") - FModioErrorCode Status; -}; - -#pragma region ToUnreal implementation -FORCEINLINE FModioModManagementEvent ToUnreal(const Modio::ModManagementEvent& Event) -{ - return FModioModManagementEvent(Event); -} - -MODIO_BEGIN_CONVERT_SWITCHES -FORCEINLINE EModioModManagementEventType ToUnreal(Modio::ModManagementEvent::EventType Event) -{ - switch (Event) - { - case Modio::ModManagementEvent::EventType::Installed: - return EModioModManagementEventType::Installed; - case Modio::ModManagementEvent::EventType::Uninstalled: - return EModioModManagementEventType::Uninstalled; - case Modio::ModManagementEvent::EventType::Updated: - return EModioModManagementEventType::Updated; - } - - checkf(false, TEXT("Missed a case in ToModio(EModioEnvironment Environment)")); - return EModioModManagementEventType::Installed; -} -MODIO_END_CONVERT_SWITCHES - -#pragma endregion diff --git a/Source/Modio/Classes/Types/ModioModTag.h b/Source/Modio/Classes/Types/ModioModTag.h deleted file mode 100644 index 68085c4d..00000000 --- a/Source/Modio/Classes/Types/ModioModTag.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -#include "Containers/UnrealString.h" -#include "ModioSDK.h" - -// clang-format off -#include "ModioModTag.generated.h" -// clang-format on - -USTRUCT(BlueprintType) -struct MODIO_API FModioModTag -{ - GENERATED_BODY() - - FModioModTag() = default; - FModioModTag(const Modio::ModTag& ModTag); - - UPROPERTY(BlueprintReadOnly, Category = "ModTag") - FString Tag; -}; - -#pragma region ToUnreal implementation -FORCEINLINE FModioModTag ToUnreal(const Modio::ModTag& ModTag) -{ - return FModioModTag(ModTag); -} -#pragma endregion diff --git a/Source/Modio/Classes/Types/ModioPagedResult.h b/Source/Modio/Classes/Types/ModioPagedResult.h deleted file mode 100644 index c74950ad..00000000 --- a/Source/Modio/Classes/Types/ModioPagedResult.h +++ /dev/null @@ -1,54 +0,0 @@ -#pragma once - -#include "ModioSDK.h" - -// clang-format off -#include "ModioPagedResult.generated.h" -// clang-format on - -/** Base class for all api endpoints that can return paged results */ -USTRUCT(BlueprintType) -struct MODIO_API FModioPagedResult -{ - GENERATED_BODY() - - FModioPagedResult() = default; - FModioPagedResult(const Modio::PagedResult& Other); - FModioPagedResult(int32 ResultOffset, int32 PageSize, int32 TotalResultCount, int32 ResultCount); - - inline int32 GetPageIndex() const - { - return PageIndex; - } - inline int32 GetPageSize() const - { - return PageSize; - } - - inline int32 GetTotalResultCount() const - { - return TotalResultCount; - } - - inline int32 GetResultCount() const - { - return ResultCount; - } -protected: - UPROPERTY(BlueprintReadOnly,Category="mod.io|PagedResult|Page") - int32 PageIndex; - - UPROPERTY(BlueprintReadOnly,Category="mod.io|PagedResult|Page") - int32 PageSize; - - UPROPERTY(BlueprintReadOnly,Category="mod.io|PagedResult|Page") - int32 PageCount; - - UPROPERTY(BlueprintReadOnly,Category="mod.io|PagedResult") - int32 TotalResultCount; - - UPROPERTY(BlueprintReadOnly,Category="mod.io|PagedResult") - int32 ResultCount; -}; - -static_assert(sizeof(FModioPagedResult) == sizeof(Modio::PagedResult), "Modio::PagedResult wrapper size mismatch"); diff --git a/Source/Modio/GeneratedHeader/ModioErrorCondition.h b/Source/Modio/GeneratedHeader/ModioErrorCondition.h new file mode 100644 index 00000000..ec3b83a6 --- /dev/null +++ b/Source/Modio/GeneratedHeader/ModioErrorCondition.h @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io SDK. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once + +#include "ModioErrorCondition.generated.h" + +UENUM(BlueprintType) +enum class EModioErrorCondition: uint8 +{ + NoError = 0, + NetworkError = 2 UMETA(ToolTip="When this condition is true, the error code represents a connection or HTTP error between the client and the mod.io server.") , + ConfigurationError = 3 UMETA(ToolTip="When this condition is true, the error code indicates the SDK's configuration is not valid - the game ID or API key are incorrect or the game has been deleted.") , + InvalidArgsError = 4 UMETA(ToolTip="When this condition is true, the error code indicates the arguments passed to the function have failed validation or were otherwise invalid.") , + FilesystemError = 5 UMETA(ToolTip="When this condition is true, the error code indicates a permission or IO error when accessing local filesystem data.") , + InternalError = 6 UMETA(ToolTip="When this condition is true, the error code represents an internal SDK error - please inform mod.io of the error code value.") , + EntityNotFoundError = 12 UMETA(ToolTip="When this condition is true, the error code indicates that a specified game, mod, media file or mod file was not found.") , + UserTermsOfUseError = 13 UMETA(ToolTip="When this condition is true, the error code indicates that the user has not yet accepted the mod.io Terms of Use.") , + SubmitReportError = 14 UMETA(ToolTip="When this condition is true, the error code indicates that a report for the specified content could not be submitted.") , +}; diff --git a/Source/Modio/GeneratedHeader/ModioErrorConditionLibrary.h b/Source/Modio/GeneratedHeader/ModioErrorConditionLibrary.h deleted file mode 100644 index 70b0c47e..00000000 --- a/Source/Modio/GeneratedHeader/ModioErrorConditionLibrary.h +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once -#include "Kismet/BlueprintFunctionLibrary.h" -#include "Types/ModioErrorCode.h" - -#include "ModioErrorConditionLibrary.generated.h" - -UENUM(BlueprintType) -enum class EModioErrorCondition: uint8 -{ - NoError = 0, - NetworkError = (uint8) Modio::ErrorConditionTypes::NetworkError UMETA(ToolTip="When this condition is true, the error code represents a connection or HTTP error between the client and the mod.io server.") , - ConfigurationError = (uint8) Modio::ErrorConditionTypes::ConfigurationError UMETA(ToolTip="When this condition is true, the error code indicates the SDK's configuration is not valid - the game ID or API key are incorrect or the game has been deleted.") , - InvalidArgsError = (uint8) Modio::ErrorConditionTypes::InvalidArgsError UMETA(ToolTip="When this condition is true, the error code indicates the arguments passed to the function have failed validation or were otherwise invalid.") , - FilesystemError = (uint8) Modio::ErrorConditionTypes::FilesystemError UMETA(ToolTip="When this condition is true, the error code indicates a permission or IO error when accessing local filesystem data.") , - InternalError = (uint8) Modio::ErrorConditionTypes::InternalError UMETA(ToolTip="When this condition is true, the error code represents an internal SDK error - please inform mod.io of the error code value.") , - EntityNotFoundError = (uint8) Modio::ErrorConditionTypes::EntityNotFoundError UMETA(ToolTip="When this condition is true, the error code indicates that a specified game, mod, media file or mod file was not found.") , - UserTermsOfUseError = (uint8) Modio::ErrorConditionTypes::UserTermsOfUseError UMETA(ToolTip="When this condition is true, the error code indicates that the user has not yet accepted the mod.io Terms of Use.") , -}; - -UCLASS() -class UModioErrorConditionLibrary : public UBlueprintFunctionLibrary -{ - GENERATED_BODY() - -public: - /** - * @brief Checks if the passed-in ErrorCode matches the specified error condition - * @param ErrorCode The code to check - * @param Condition The error condition to check against - * @return true if the code matches the condition - */ - UFUNCTION(BlueprintCallable, Category = "mod.io|Error Handling") - static bool ErrorCodeMatches(FModioErrorCode ErrorCode, EModioErrorCondition Condition) - { - if (Condition == EModioErrorCondition::NoError) - { - return (bool)ErrorCode.GetRawErrorCode(); - } - return Modio::ErrorCodeMatches(ErrorCode.GetRawErrorCode(), static_cast(Condition)); - } - -}; \ No newline at end of file diff --git a/Source/Modio/GeneratedSource/ArchiveFileImplementation.cpp b/Source/Modio/GeneratedSource/ArchiveFileImplementation.cpp index 7577b9d9..9e35edba 100644 --- a/Source/Modio/GeneratedSource/ArchiveFileImplementation.cpp +++ b/Source/Modio/GeneratedSource/ArchiveFileImplementation.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io SDK. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #ifdef MODIO_SEPARATE_COMPILATION #include "modio/detail/compression/zip/ArchiveFileImplementation.h" #endif diff --git a/Source/Modio/GeneratedSource/HttpSharedState.cpp b/Source/Modio/GeneratedSource/HttpSharedState.cpp index 0adbaf9e..d92f3cf8 100644 --- a/Source/Modio/GeneratedSource/HttpSharedState.cpp +++ b/Source/Modio/GeneratedSource/HttpSharedState.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io SDK. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #ifdef MODIO_SEPARATE_COMPILATION #include "common/HttpSharedState.h" #endif diff --git a/Source/Modio/GeneratedSource/ModioBuffer.cpp b/Source/Modio/GeneratedSource/ModioBuffer.cpp index 483500a7..87c298fb 100644 --- a/Source/Modio/GeneratedSource/ModioBuffer.cpp +++ b/Source/Modio/GeneratedSource/ModioBuffer.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io SDK. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #ifdef MODIO_SEPARATE_COMPILATION #include "modio/core/ModioBuffer.h" #endif diff --git a/Source/Modio/GeneratedSource/ModioCacheService.cpp b/Source/Modio/GeneratedSource/ModioCacheService.cpp index 848b6444..aa506a61 100644 --- a/Source/Modio/GeneratedSource/ModioCacheService.cpp +++ b/Source/Modio/GeneratedSource/ModioCacheService.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io SDK. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #ifdef MODIO_SEPARATE_COMPILATION #include "modio/cache/ModioCacheService.h" #endif diff --git a/Source/Modio/GeneratedSource/ModioCompressionService.cpp b/Source/Modio/GeneratedSource/ModioCompressionService.cpp index 613d5f6a..5096c944 100644 --- a/Source/Modio/GeneratedSource/ModioCompressionService.cpp +++ b/Source/Modio/GeneratedSource/ModioCompressionService.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io SDK. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #ifdef MODIO_SEPARATE_COMPILATION #include "modio/compression/ModioCompressionService.h" #endif diff --git a/Source/Modio/GeneratedSource/ModioFileMetadata.cpp b/Source/Modio/GeneratedSource/ModioFileMetadata.cpp index 39d193c5..768c41a2 100644 --- a/Source/Modio/GeneratedSource/ModioFileMetadata.cpp +++ b/Source/Modio/GeneratedSource/ModioFileMetadata.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io SDK. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #ifdef MODIO_SEPARATE_COMPILATION #include "modio/core/entities/ModioFileMetadata.h" #else diff --git a/Source/Modio/GeneratedSource/ModioFilterParams.cpp b/Source/Modio/GeneratedSource/ModioFilterParams.cpp index 79e6e1c6..c22103ae 100644 --- a/Source/Modio/GeneratedSource/ModioFilterParams.cpp +++ b/Source/Modio/GeneratedSource/ModioFilterParams.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io SDK. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #ifdef MODIO_SEPARATE_COMPILATION #include "modio/core/ModioFilterParams.h" #endif diff --git a/Source/Modio/GeneratedSource/ModioHttpParams.cpp b/Source/Modio/GeneratedSource/ModioHttpParams.cpp index 7037da03..6676286e 100644 --- a/Source/Modio/GeneratedSource/ModioHttpParams.cpp +++ b/Source/Modio/GeneratedSource/ModioHttpParams.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io SDK. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #ifdef MODIO_SEPARATE_COMPILATION #include "modio/http/ModioHttpParams.h" #endif diff --git a/Source/Modio/GeneratedSource/ModioHttpRequest.cpp b/Source/Modio/GeneratedSource/ModioHttpRequest.cpp index 66ddf7b9..d94413b7 100644 --- a/Source/Modio/GeneratedSource/ModioHttpRequest.cpp +++ b/Source/Modio/GeneratedSource/ModioHttpRequest.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io SDK. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #ifdef MODIO_SEPARATE_COMPILATION #include "modio/http/ModioHttpRequest.h" #endif diff --git a/Source/Modio/GeneratedSource/ModioHttpService.cpp b/Source/Modio/GeneratedSource/ModioHttpService.cpp index a81c5f42..59b74bc0 100644 --- a/Source/Modio/GeneratedSource/ModioHttpService.cpp +++ b/Source/Modio/GeneratedSource/ModioHttpService.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io SDK. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #ifdef MODIO_SEPARATE_COMPILATION #include "modio/http/ModioHttpService.h" #endif diff --git a/Source/Modio/GeneratedSource/ModioInitializeOptions.cpp b/Source/Modio/GeneratedSource/ModioInitializeOptions.cpp index 6031f62f..ea623f0d 100644 --- a/Source/Modio/GeneratedSource/ModioInitializeOptions.cpp +++ b/Source/Modio/GeneratedSource/ModioInitializeOptions.cpp @@ -1,4 +1,14 @@ -#ifdef MODIO_SEPARATE_COMPILATION +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io SDK. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#ifdef MODIO_SEPARATE_COMPILATION #include "modio/core/ModioInitializeOptions.h" #endif diff --git a/Source/Modio/GeneratedSource/ModioJsonHelpers.cpp b/Source/Modio/GeneratedSource/ModioJsonHelpers.cpp index 88a70161..03a22a2e 100644 --- a/Source/Modio/GeneratedSource/ModioJsonHelpers.cpp +++ b/Source/Modio/GeneratedSource/ModioJsonHelpers.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io SDK. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #ifdef MODIO_SEPARATE_COMPILATION #include "modio/detail/ModioJsonHelpers.h" #endif diff --git a/Source/Modio/GeneratedSource/ModioLogService.cpp b/Source/Modio/GeneratedSource/ModioLogService.cpp index 483aa3ab..396a6423 100644 --- a/Source/Modio/GeneratedSource/ModioLogService.cpp +++ b/Source/Modio/GeneratedSource/ModioLogService.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io SDK. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #ifdef MODIO_SEPARATE_COMPILATION #include "modio/core/ModioLogService.h" #endif diff --git a/Source/Modio/GeneratedSource/ModioModCollectionEntry.cpp b/Source/Modio/GeneratedSource/ModioModCollectionEntry.cpp index bf91028c..3b4d2c64 100644 --- a/Source/Modio/GeneratedSource/ModioModCollectionEntry.cpp +++ b/Source/Modio/GeneratedSource/ModioModCollectionEntry.cpp @@ -1,3 +1,12 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io SDK. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ #ifdef MODIO_SEPARATE_COMPILATION #include "modio/core/ModioModCollectionEntry.h" diff --git a/Source/Modio/GeneratedSource/ModioModDetails.cpp b/Source/Modio/GeneratedSource/ModioModDetails.cpp index 44e6d8ef..02e46d87 100644 --- a/Source/Modio/GeneratedSource/ModioModDetails.cpp +++ b/Source/Modio/GeneratedSource/ModioModDetails.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io SDK. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #ifdef MODIO_SEPARATE_COMPILATION #include "modio/core/entities/ModioModDetails.h" #endif diff --git a/Source/Modio/GeneratedSource/ModioModInfo.cpp b/Source/Modio/GeneratedSource/ModioModInfo.cpp index 7e7eed03..a78121cc 100644 --- a/Source/Modio/GeneratedSource/ModioModInfo.cpp +++ b/Source/Modio/GeneratedSource/ModioModInfo.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io SDK. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #ifdef MODIO_SEPARATE_COMPILATION #include "modio/core/entities/ModioModInfo.h" #endif diff --git a/Source/Modio/GeneratedSource/ModioModStats.cpp b/Source/Modio/GeneratedSource/ModioModStats.cpp index 11c9bab0..a094f0a4 100644 --- a/Source/Modio/GeneratedSource/ModioModStats.cpp +++ b/Source/Modio/GeneratedSource/ModioModStats.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io SDK. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #ifdef MODIO_SEPARATE_COMPILATION #include "modio/core/entities/ModioModStats.h" #endif diff --git a/Source/Modio/GeneratedSource/ModioObjectTrack.cpp b/Source/Modio/GeneratedSource/ModioObjectTrack.cpp index 146a42f9..dd9c321e 100644 --- a/Source/Modio/GeneratedSource/ModioObjectTrack.cpp +++ b/Source/Modio/GeneratedSource/ModioObjectTrack.cpp @@ -1,4 +1,14 @@ -#pragma once +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io SDK. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once #ifdef MODIO_SEPARATE_COMPILATION #include "modio/detail/ModioObjectTrack.h" #endif diff --git a/Source/Modio/GeneratedSource/ModioPagedResult.cpp b/Source/Modio/GeneratedSource/ModioPagedResult.cpp index 96cce70c..8614f381 100644 --- a/Source/Modio/GeneratedSource/ModioPagedResult.cpp +++ b/Source/Modio/GeneratedSource/ModioPagedResult.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io SDK. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #ifdef MODIO_SEPARATE_COMPILATION #include "modio/core/entities/ModioPagedResult.h" #endif diff --git a/Source/Modio/GeneratedSource/ModioReportParams.cpp b/Source/Modio/GeneratedSource/ModioReportParams.cpp new file mode 100644 index 00000000..5424ba0d --- /dev/null +++ b/Source/Modio/GeneratedSource/ModioReportParams.cpp @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io SDK. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#ifdef MODIO_SEPARATE_COMPILATION + #include "modio/core/ModioReportParams.h" +#endif + +#include "modio/detail/ModioConstants.h" +#include "modio/http/ModioHttpParams.h" + +namespace Modio +{ + ReportParams::ReportParams(std::int64_t ResourceID, ResourceType ReportedResourceType, Modio::ReportType Type, + std::string ReportDescription, Modio::Optional ReporterName, + Modio::Optional ReporterContact) + : ReporterName(ReporterName), + ReporterContact(ReporterContact), + ReportDescription(ReportDescription), + ReportedResourceType(ReportedResourceType), + ResourceID(ResourceID), + Type(Type) + {} + + ReportParams::ReportParams(Modio::GameID Game, Modio::ReportType Type, std::string ReportDescription, + Modio::Optional ReporterName, Modio::Optional ReporterContact) + : ReportParams(Game, ResourceType::Game, Type, ReportDescription, ReporterName, ReporterContact) + {} + + ReportParams::ReportParams(Modio::ModID Mod, Modio::ReportType Type, std::string ReportDescription, + Modio::Optional ReporterName, Modio::Optional ReporterContact) + : ReportParams(Mod, ResourceType::Mod, Type, ReportDescription, ReporterName, ReporterContact) + {} + + ReportParams::ReportParams(Modio::UserID User, Modio::ReportType Type, std::string ReportDescription, + Modio::Optional ReporterName, Modio::Optional ReporterContact) + : ReportParams(User, ResourceType::User, Type, ReportDescription, ReporterName, ReporterContact) + {} + Modio::Detail::HttpRequestParams ToRequest(const Modio::ReportParams& Params) + { + std::string ResourceString; + switch (Params.ReportedResourceType) + { + case ReportParams::ResourceType::Game: + ResourceString = "games"; + break; + case ReportParams::ResourceType::Mod: + ResourceString = "mods"; + break; + case ReportParams::ResourceType::User: + ResourceString = "users"; + break; + } + + Modio::Detail::HttpRequestParams Request = Modio::Detail::SubmitReportRequest; + if (Params.ReporterName) + { + Request.AppendPayloadValue(Modio::Detail::Constants::APIStrings::ReportSubmitterName, Params.ReporterName.value()); + } + if (Params.ReporterContact) + { + Request.AppendPayloadValue(Modio::Detail::Constants::APIStrings::ReportSubmitterContact, Params.ReporterContact.value()); + } + + return Request.AppendPayloadValue(Modio::Detail::Constants::APIStrings::ReportResourceType, ResourceString) + .AppendPayloadValue(Modio::Detail::Constants::APIStrings::ReportResourceID, + fmt::format("{}", Params.ResourceID)) + .AppendPayloadValue(Modio::Detail::Constants::APIStrings::ReportType, + fmt::format("{}", static_cast(Params.Type))) + .AppendPayloadValue(Modio::Detail::Constants::APIStrings::ReportSummary, Params.ReportDescription); + } +} // namespace Modio diff --git a/Source/Modio/GeneratedSource/ModioSDKSessionData.cpp b/Source/Modio/GeneratedSource/ModioSDKSessionData.cpp index cbe16b7f..e319d087 100644 --- a/Source/Modio/GeneratedSource/ModioSDKSessionData.cpp +++ b/Source/Modio/GeneratedSource/ModioSDKSessionData.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io SDK. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #ifdef MODIO_SEPARATE_COMPILATION #include "modio/detail/ModioSDKSessionData.h" #endif diff --git a/Source/Modio/GeneratedSource/ModioURLList.cpp b/Source/Modio/GeneratedSource/ModioURLList.cpp index 130b19be..c26a61bf 100644 --- a/Source/Modio/GeneratedSource/ModioURLList.cpp +++ b/Source/Modio/GeneratedSource/ModioURLList.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io SDK. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #ifdef MODIO_SEPARATE_COMPILATION #include "modio/core/entities/ModioURLList.h" #endif diff --git a/Source/Modio/GeneratedSource/ModioUserDataContainer.cpp b/Source/Modio/GeneratedSource/ModioUserDataContainer.cpp index 93d8b65d..31ed8a1e 100644 --- a/Source/Modio/GeneratedSource/ModioUserDataContainer.cpp +++ b/Source/Modio/GeneratedSource/ModioUserDataContainer.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io SDK. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #ifdef MODIO_SEPARATE_COMPILATION #include "modio/detail/userdata/ModioUserDataContainer.h" #endif diff --git a/Source/Modio/GeneratedSource/ModioUserProfile.cpp b/Source/Modio/GeneratedSource/ModioUserProfile.cpp index 734521b9..80ed2d76 100644 --- a/Source/Modio/GeneratedSource/ModioUserProfile.cpp +++ b/Source/Modio/GeneratedSource/ModioUserProfile.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io SDK. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #ifdef MODIO_SEPARATE_COMPILATION #include "modio/detail/userdata/ModioUserProfile.h" #endif diff --git a/Source/Modio/GeneratedSource/SDKCore.cpp b/Source/Modio/GeneratedSource/SDKCore.cpp index 05b3775c..e2877243 100644 --- a/Source/Modio/GeneratedSource/SDKCore.cpp +++ b/Source/Modio/GeneratedSource/SDKCore.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io SDK. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #pragma once #ifdef MODIO_SEPARATE_COMPILATION @@ -7,6 +17,7 @@ #include "modio/cache/ModioCacheService.h" #include "modio/detail/ModioSDKSessionData.h" #include "modio/detail/ops/ServiceInitializationOp.h" +#include "modio/detail/ops/ReportContentOp.h" #include "modio/detail/ops/Shutdown.h" #include "modio/file/ModioFileService.h" #include "modio/http/ModioHttpService.h" @@ -116,4 +127,15 @@ namespace Modio { return Modio::Detail::SDKSessionData::GetLastValidationError(); } + + void ReportContentAsync(Modio::ReportParams Report, std::function Callback) + { + if (Modio::Detail::RequireSDKIsInitialized(Callback)) + { + + asio::async_compose, void(Modio::ErrorCode)>( + Modio::Detail::ReportContentOp(Report), Callback, + Modio::Detail::Services::GetGlobalContext().get_executor()); + } + } } // namespace Modio diff --git a/Source/Modio/GeneratedSource/SDKModManagement.cpp b/Source/Modio/GeneratedSource/SDKModManagement.cpp index 7bb38c40..801cbd0a 100644 --- a/Source/Modio/GeneratedSource/SDKModManagement.cpp +++ b/Source/Modio/GeneratedSource/SDKModManagement.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io SDK. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #pragma once #ifdef MODIO_SEPARATE_COMPILATION diff --git a/Source/Modio/GeneratedSource/SDKModMetadata.cpp b/Source/Modio/GeneratedSource/SDKModMetadata.cpp index 3758b6ef..357bd6f9 100644 --- a/Source/Modio/GeneratedSource/SDKModMetadata.cpp +++ b/Source/Modio/GeneratedSource/SDKModMetadata.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io SDK. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #pragma once #ifdef MODIO_SEPARATE_COMPILATION @@ -16,6 +26,7 @@ #include "modio/detail/ops/mod/GetModMediaLogoOp.h" #include "modio/detail/ops/mod/GetModTagsOp.h" #include "modio/detail/ops/mod/ListAllModsOp.h" +#include "modio/detail/ops/mod/SubmitModRatingOp.h" #include "modio/impl/SDKPreconditionChecks.h" // Implementation header - do not include directly @@ -108,4 +119,14 @@ namespace Modio } } + void SubmitModRatingAsync(Modio::ModID ModID, Modio::Rating Rating, std::function Callback) + { + if (Modio::Detail::RequireSDKIsInitialized(Callback) && Modio::Detail::RequireNotRateLimited(Callback) && + Modio::Detail::RequireUserIsAuthenticated(Callback)) + { + return asio::async_compose, void(Modio::ErrorCode)>( + Modio::Detail::SubmitModRatingOp(ModID, Rating), Callback, + Modio::Detail::Services::GetGlobalContext().get_executor()); + } + } } // namespace Modio diff --git a/Source/Modio/GeneratedSource/SDKUserData.cpp b/Source/Modio/GeneratedSource/SDKUserData.cpp index c04a25d7..50fc9cad 100644 --- a/Source/Modio/GeneratedSource/SDKUserData.cpp +++ b/Source/Modio/GeneratedSource/SDKUserData.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io SDK. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #pragma once // Implementation header - do not include directly diff --git a/Source/Modio/GeneratedSource/deflate_stream.cpp b/Source/Modio/GeneratedSource/deflate_stream.cpp index a5bd03e0..ebdf0491 100644 --- a/Source/Modio/GeneratedSource/deflate_stream.cpp +++ b/Source/Modio/GeneratedSource/deflate_stream.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io SDK. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #if(0) //We don't currently create archives, this will be re-enabled later // // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) diff --git a/Source/Modio/GeneratedSource/inflate_stream.cpp b/Source/Modio/GeneratedSource/inflate_stream.cpp index 00fd2c5d..cbe77b46 100644 --- a/Source/Modio/GeneratedSource/inflate_stream.cpp +++ b/Source/Modio/GeneratedSource/inflate_stream.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io SDK. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + // // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) // diff --git a/Source/Modio/Modio.Build.cs b/Source/Modio/Modio.Build.cs index 8d8dce09..91bd2ee6 100644 --- a/Source/Modio/Modio.Build.cs +++ b/Source/Modio/Modio.Build.cs @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. using System.IO; using System.Collections.Generic; @@ -12,7 +22,7 @@ public Modio(ReadOnlyTargetRules Target) : base(Target) bEnableUndefinedIdentifierWarnings = false; bEnforceIWYU = true; - + //bUseUnity = false; //Add stub generated header { string GeneratedHeaderPath = Path.Combine(ModuleDirectory, "GeneratedHeader"); @@ -25,32 +35,32 @@ public Modio(ReadOnlyTargetRules Target) : base(Target) { }; // Silly hack/workaround until 4.26 adds ConditionalAddModuleDirectory - we may change where this lives in the native SDK later - string ErrorConditionLibraryPath = Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/modio/modio/core/ModioErrorConditionLibrary.h"); + string ErrorConditionLibraryPath = Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/modio/modio/core/ModioErrorCondition.h"); // Add dependency on the upstream file so if it is modified we re-run and copy it again ExternalDependencies.Add(ErrorConditionLibraryPath); - File.Copy(ErrorConditionLibraryPath, Path.Combine(GeneratedHeaderPath, "ModioErrorConditionLibrary.h"), true); + File.Copy(ErrorConditionLibraryPath, Path.Combine(GeneratedHeaderPath, "ModioErrorCondition.h"), true); PublicIncludePaths.AddRange(new string[] { - Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/modio"), - GeneratedHeaderPath }); PublicSystemIncludePaths.AddRange(new string[] { - Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/ext/json/single_include"), - Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/ext/filesystem/include"), - Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/ext/fmt/include"), - Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/ext/optional/include"), - Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/platform/interface"), }); PrivateIncludePaths.AddRange(new string[] { - Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/ext/asio/asio/include"), - Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/ext/utfcpp/source"), - Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/ext/httpparser/src"), - Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/platform/ms-common/include"), - Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/platform/win32/win32"), + Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/ext/json/single_include"), + Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/ext/filesystem/include"), + Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/ext/fmt/include"), + Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/ext/optional/include"), + Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/ext/asio/asio/include"), + Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/ext/utfcpp/source"), + Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/ext/httpparser/src"), + Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/platform/interface"), + Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/platform/ms-common/include"), + Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/platform/win32/win32"), + Path.Combine(ModuleDirectory, "../ThirdParty/NativeSDK/modio"), + GeneratedHeaderPath }); } // Add native SDK implementation to this module so we don't have to create an extraneous module diff --git a/Source/Modio/Private/Internal/Convert/AuthParams.h b/Source/Modio/Private/Internal/Convert/AuthParams.h new file mode 100644 index 00000000..76d433d1 --- /dev/null +++ b/Source/Modio/Private/Internal/Convert/AuthParams.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once + +#include "ModioSDK.h" +#include "GenericPlatform/GenericPlatformHttp.h" +#include "Internal/ModioConvert.h" +#include "Internal/ModioPrivateDefines.h" +#include "Misc/Optional.h" +#include "Types/ModioAuthenticationParams.h" + + +MODIO_BEGIN_CONVERT_SWITCHES +FORCEINLINE Modio::AuthenticationProvider ToModio(EModioAuthenticationProvider Provider) +{ + switch (Provider) + { + case EModioAuthenticationProvider::XboxLive: + return Modio::AuthenticationProvider::XboxLive; + case EModioAuthenticationProvider::Steam: + return Modio::AuthenticationProvider::Steam; + case EModioAuthenticationProvider::GoG: + return Modio::AuthenticationProvider::GoG; + case EModioAuthenticationProvider::Itch: + return Modio::AuthenticationProvider::Itch; + case EModioAuthenticationProvider::Switch: + return Modio::AuthenticationProvider::Switch; + case EModioAuthenticationProvider::Discord: + return Modio::AuthenticationProvider::Discord; + } + + return Modio::AuthenticationProvider::Steam; +} +MODIO_END_CONVERT_SWITCHES + + +FORCEINLINE Modio::AuthenticationParams ToModio(const FModioAuthenticationParams& UnrealParams) +{ + Modio::AuthenticationParams Params; + Params.AuthToken = ToSTD(FGenericPlatformHttp::UrlEncode(UnrealParams.AuthToken)); + Params.UserEmail = UnrealParams.UserEmail.TrimStartAndEnd().IsEmpty() ? Modio::Optional(ToSTD(UnrealParams.UserEmail)) : Modio::Optional(); + Params.bUserHasAcceptedTerms = UnrealParams.bUserHasAcceptedTerms; + + return Params; +} \ No newline at end of file diff --git a/Source/Modio/Private/Internal/Convert/ErrorCode.h b/Source/Modio/Private/Internal/Convert/ErrorCode.h new file mode 100644 index 00000000..95e5d34c --- /dev/null +++ b/Source/Modio/Private/Internal/Convert/ErrorCode.h @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once + +#include "Types/ModioErrorCode.h" +#include "ModioSDK.h" + +FModioErrorCode ToUnreal(Modio::ErrorCode ec) +{ + return FModioErrorCode(ec); +} \ No newline at end of file diff --git a/Source/Modio/Private/Internal/Convert/FileMetadata.h b/Source/Modio/Private/Internal/Convert/FileMetadata.h new file mode 100644 index 00000000..c3bdc76b --- /dev/null +++ b/Source/Modio/Private/Internal/Convert/FileMetadata.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once +#include "Internal/ModioPrivateDefines.h" +#include "ModioSDK.h" +#include "Types/ModioFileMetadata.h" + + + + +MODIO_BEGIN_CONVERT_SWITCHES +FORCEINLINE EModioVirusScanStatus ToUnreal(Modio::FileMetadata::VirusScanStatus VirusScanStatus) +{ + switch (VirusScanStatus) + { + case Modio::FileMetadata::VirusScanStatus::NotScanned: + return EModioVirusScanStatus::NotScanned; + case Modio::FileMetadata::VirusScanStatus::ScanComplete: + return EModioVirusScanStatus::ScanComplete; + case Modio::FileMetadata::VirusScanStatus::InProgress: + return EModioVirusScanStatus::InProgress; + case Modio::FileMetadata::VirusScanStatus::TooLargeToScan: + return EModioVirusScanStatus::TooLargeToScan; + case Modio::FileMetadata::VirusScanStatus::FileNotFound: + return EModioVirusScanStatus::FileNotFound; + case Modio::FileMetadata::VirusScanStatus::ErrorScanning: + return EModioVirusScanStatus::ErrorScanning; + } + + return EModioVirusScanStatus::NotScanned; +} + +FORCEINLINE EModioVirusStatus ToUnreal(Modio::FileMetadata::VirusStatus VirusStatus) +{ + switch (VirusStatus) + { + case Modio::FileMetadata::VirusStatus::NoThreat: + return EModioVirusStatus::NoThreat; + case Modio::FileMetadata::VirusStatus::Malicious: + return EModioVirusStatus::Malicious; + } + + return EModioVirusStatus::NoThreat; +} +MODIO_END_CONVERT_SWITCHES + +FORCEINLINE FModioFileMetadata ToUnreal(const Modio::FileMetadata& FileMetadata) +{ + FModioFileMetadata Out; + Out.MetadataId = ToUnreal(FileMetadata.MetadataId); + Out.ModId = ToUnreal(FileMetadata.ModId); + Out.DateAdded = ToUnrealDateTime(FileMetadata.DateAdded); + Out.CurrentVirusScanStatus = ToUnreal(FileMetadata.CurrentVirusScanStatus); + Out.CurrentVirusStatus = ToUnreal(FileMetadata.CurrentVirusStatus); + Out.Filesize = ToUnreal(FileMetadata.Filesize); + Out.Filename = ToUnreal(FileMetadata.Filename); + Out.Version = ToUnreal(FileMetadata.Version); + Out.Changelog = ToUnreal(FileMetadata.Changelog); + Out.MetadataBlob = FString(FileMetadata.MetadataBlob.c_str()); + return Out; +} diff --git a/Source/Modio/Private/Internal/Convert/FilterParams.h b/Source/Modio/Private/Internal/Convert/FilterParams.h new file mode 100644 index 00000000..73b6d5a2 --- /dev/null +++ b/Source/Modio/Private/Internal/Convert/FilterParams.h @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once +#include "Internal/ModioConvert.h" +#include "Internal/ModioPrivateDefines.h" + +#include "ModioSDK.h" + +MODIO_BEGIN_CONVERT_SWITCHES +FORCEINLINE Modio::FilterParams::SortDirection ToModio(EModioSortDirection SortDirection) +{ + switch (SortDirection) + { + case EModioSortDirection::Ascending: + return Modio::FilterParams::SortDirection::Ascending; + case EModioSortDirection::Descending: + return Modio::FilterParams::SortDirection::Descending; + } + + return Modio::FilterParams::SortDirection::Ascending; +} + +FORCEINLINE Modio::FilterParams::SortFieldType ToModio(EModioSortFieldType Environment) +{ + switch (Environment) + { + case EModioSortFieldType::ID: + return Modio::FilterParams::SortFieldType::ID; + case EModioSortFieldType::DownloadsToday: + return Modio::FilterParams::SortFieldType::DownloadsToday; + case EModioSortFieldType::SubscriberCount: + return Modio::FilterParams::SortFieldType::SubscriberCount; + case EModioSortFieldType::Rating: + return Modio::FilterParams::SortFieldType::Rating; + case EModioSortFieldType::DateMarkedLive: + return Modio::FilterParams::SortFieldType::DateMarkedLive; + case EModioSortFieldType::DateUpdated: + return Modio::FilterParams::SortFieldType::DateUpdated; + } + + return Modio::FilterParams::SortFieldType::ID; +} +MODIO_END_CONVERT_SWITCHES + +FORCEINLINE Modio::FilterParams ToModio(const FModioFilterParams& In ) +{ + + Modio::FilterParams Out; + + if (In.isPaged) + { + Out.PagedResults(In.Index,In.Count); + } + else + { + Out.IndexedResults(In.Index,In.Count); + } + + if (In.DateRangeBegin) + { + Out.MarkedLiveAfter(ToSTD(In.DateRangeBegin.GetValue())); + } + + if (In.DateRangeEnd) + { + Out.MarkedLiveBefore(ToSTD(In.DateRangeEnd.GetValue())); + } + + return Out.SortBy(ToModio(In.SortField), ToModio(In.Direction)) + .NameContains(ToSTD(In.SearchKeywords)) + .MatchingIDs(ToModio(In.IncludedIDs)) + .ExcludingIDs(ToModio(In.ExcludedIDs)) + .WithTags(ToSTD(In.Tags)) + .WithoutTags(ToSTD(In.ExcludedTags)); +} \ No newline at end of file diff --git a/Source/Modio/Private/Types/ModioSDKInitializeOptions.cpp b/Source/Modio/Private/Internal/Convert/InitializeOptions.h similarity index 55% rename from Source/Modio/Private/Types/ModioSDKInitializeOptions.cpp rename to Source/Modio/Private/Internal/Convert/InitializeOptions.h index 38c8134b..b1cdfc0f 100644 --- a/Source/Modio/Private/Types/ModioSDKInitializeOptions.cpp +++ b/Source/Modio/Private/Internal/Convert/InitializeOptions.h @@ -1,10 +1,25 @@ -#include "Types/ModioInitializeOptions.h" +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once +#include "Internal/ModioConvert.h" +#include "Internal/ModioPrivateDefines.h" +#include "ModioSDK.h" +#include "Types/ModioInitializeOptions.h" #include "Modio.h" + // For GetUserSidString #include #include -static std::string GetUserSidString() +static FORCEINLINE std::string GetUserSidString() { LPSTR SidString = nullptr; @@ -44,14 +59,13 @@ static std::string GetUserSidString() return SIDStringCopy; } - -FModioInitializeOptions::operator Modio::InitializeOptions() const +FORCEINLINE Modio::InitializeOptions ToModio(const FModioInitializeOptions& In ) { - Modio::InitializeOptions Options; - Options.GameID = GameID; - Options.APIKey = APIKey; - Options.GameEnvironment = ToModio(GameEnvironment); - Options.User = GetUserSidString(); - Options.PortalInUse = ToModio(PortalInUse); - return Options; -} + Modio::InitializeOptions Options; + Options.GameID = ToModio(In.GameId); + Options.APIKey = ToModio(In.ApiKey); + Options.GameEnvironment = ToModio(In.GameEnvironment); + Options.User = GetUserSidString(); + Options.PortalInUse = ToModio(In.PortalInUse); + return Options; +} \ No newline at end of file diff --git a/Source/Modio/Private/Internal/Convert/Metadata.h b/Source/Modio/Private/Internal/Convert/Metadata.h new file mode 100644 index 00000000..c23afbfc --- /dev/null +++ b/Source/Modio/Private/Internal/Convert/Metadata.h @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once + +#include "Internal/ModioConvert.h" +#include "ModioSDK.h" + +FORCEINLINE FModioMetadata ToUnreal(const Modio::Metadata& In) +{ + FModioMetadata Out; + Out.Key = ToUnreal(In.Key); + Out.Value = ToUnreal(In.Value); + return Out; +} \ No newline at end of file diff --git a/Source/Modio/Private/Internal/Convert/ModCollectionEntry.h b/Source/Modio/Private/Internal/Convert/ModCollectionEntry.h new file mode 100644 index 00000000..1347f6ef --- /dev/null +++ b/Source/Modio/Private/Internal/Convert/ModCollectionEntry.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once +#include "Types/ModioModCollectionEntry.h" +#include "Internal/ModioPrivateDefines.h" +#include "Internal/ModioConvert.h" +#include "Internal/Convert/ModInfo.h" +#include "ModioSDK.h" + + +MODIO_BEGIN_CONVERT_SWITCHES +FORCEINLINE EModioModState ToUnreal(Modio::ModState ModState) +{ + switch (ModState) + { + case Modio::ModState::InstallationPending: + return EModioModState::InstallationPending; + case Modio::ModState::Installed: + return EModioModState::Installed; + case Modio::ModState::UpdatePending: + return EModioModState::UpdatePending; + case Modio::ModState::Downloading: + return EModioModState::Downloading; + case Modio::ModState::Extracting: + return EModioModState::Extracting; + case Modio::ModState::UninstallPending: + return EModioModState::UninstallPending; + } + + checkf(false, TEXT("Missed a case in ToUnreal(Modio::ModState ModState)")); + return EModioModState::InstallationPending; +} +MODIO_END_CONVERT_SWITCHES + +FModioModCollectionEntry ToUnreal(const Modio::ModCollectionEntry& In) +{ + FModioModCollectionEntry Out; + Out.ModState = ToUnreal(In.GetModState()); + Out.ModID = ToUnreal(In.GetID()); + Out.ModPath = ToUnreal(In.GetPath()); + Out.ModProfile = ToUnreal(In.GetModProfile()); + return Out; +} + diff --git a/Source/Modio/Private/Internal/Convert/ModInfo.h b/Source/Modio/Private/Internal/Convert/ModInfo.h new file mode 100644 index 00000000..b7490bd7 --- /dev/null +++ b/Source/Modio/Private/Internal/Convert/ModInfo.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once +#include "Internal/Convert/FileMetadata.h" +#include "Internal/Convert/Metadata.h" +#include "Internal/Convert/ModStats.h" +#include "Internal/Convert/ModTag.h" +#include "Internal/Convert/URLList.h" +#include "Internal/Convert/User.h" +#include "Internal/ModioConvert.h" +#include "ModioSDK.h" +#include "Types/ModioModInfo.h" + +FORCEINLINE FModioModInfo ToUnreal(const Modio::ModInfo& In) +{ + FModioModInfo Out; + Out.ModId = ToUnreal(In.ModId); + Out.ProfileName = ToUnreal(In.ProfileName); + Out.ProfileSummary = ToUnreal(In.ProfileSummary); + Out.ProfileDescription = ToUnreal(In.ProfileDescription); + Out.ProfileDescriptionPlaintext = ToUnreal(In.ProfileDescriptionPlaintext); + Out.ProfileURL = ToUnreal(In.ProfileURL); + Out.ProfileSubmittedBy = ToUnreal(In.ProfileSubmittedBy); + Out.ProfileDateAdded = ToUnrealDateTime(In.ProfileDateAdded); + Out.ProfileDateUpdated = ToUnrealDateTime(In.ProfileDateUpdated); + Out.ProfileDateLive = ToUnrealDateTime(In.ProfileDateLive); + Out.ProfileMaturityOption = ToUnreal(In.ProfileMaturityOption); + Out.MetadataBlob = FString(In.MetadataBlob.c_str()); // Converting verbatim rather than via TCHAR as ToUnreal does + Out.FileInfo = ToUnreal(In.FileInfo); + Out.MetadataKvp = ToUnreal(In.MetadataKvp); + Out.Tags = ToUnreal(In.Tags); + Out.NumGalleryImages = ToUnreal(In.NumGalleryImages); + Out.YoutubeURLs = ToUnreal(In.YoutubeURLs); + Out.SketchfabURLs = ToUnreal(In.SketchfabURLs); + Out.Stats = ToUnreal(In.Stats); + return Out; +} \ No newline at end of file diff --git a/Source/Modio/Private/Internal/Convert/ModInfoList.h b/Source/Modio/Private/Internal/Convert/ModInfoList.h new file mode 100644 index 00000000..a3c22b3e --- /dev/null +++ b/Source/Modio/Private/Internal/Convert/ModInfoList.h @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once + +#include "ModioSDK.h" +#include "Types/ModioModInfoList.h" + +FModioModInfoList ToUnreal(const Modio::ModInfoList& In) +{ + return FModioModInfoList(In); +} \ No newline at end of file diff --git a/Source/Modio/Private/Internal/Convert/ModManagementEvent.h b/Source/Modio/Private/Internal/Convert/ModManagementEvent.h new file mode 100644 index 00000000..18613971 --- /dev/null +++ b/Source/Modio/Private/Internal/Convert/ModManagementEvent.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once +#include "Internal/ModioConvert.h" +#include "Internal/ModioPrivateDefines.h" +#include "ModioSDK.h" +#include "Types/ModioModManagementEvent.h" + + +MODIO_BEGIN_CONVERT_SWITCHES +FORCEINLINE EModioModManagementEventType ToUnreal(Modio::ModManagementEvent::EventType Event) +{ + switch (Event) + { + case Modio::ModManagementEvent::EventType::Installed: + return EModioModManagementEventType::Installed; + case Modio::ModManagementEvent::EventType::Uninstalled: + return EModioModManagementEventType::Uninstalled; + case Modio::ModManagementEvent::EventType::Updated: + return EModioModManagementEventType::Updated; + } + + checkf(false, TEXT("Missed a case in ToModio(EModioEnvironment Environment)")); + return EModioModManagementEventType::Installed; +} +MODIO_END_CONVERT_SWITCHES + + + +FORCEINLINE FModioModManagementEvent ToUnreal(const Modio::ModManagementEvent& In) +{ + FModioModManagementEvent Out; + Out.ID = ToUnreal(In.ID); + Out.Event = ToUnreal(In.Event); + Out.Status = ToUnreal(In.Status); + return Out; +} \ No newline at end of file diff --git a/Source/Modio/Private/Internal/Convert/ModProgressInfo.h b/Source/Modio/Private/Internal/Convert/ModProgressInfo.h new file mode 100644 index 00000000..3edcbfaa --- /dev/null +++ b/Source/Modio/Private/Internal/Convert/ModProgressInfo.h @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once +#include "Internal/ModioConvert.h" +#include "ModioSDK.h" +#include "Types/ModioModProgressInfo.h" + +FORCEINLINE FModioModProgressInfo ToUnreal(const Modio::ModProgressInfo& In) +{ + FModioModProgressInfo Out; + Out.TotalDownloadSize = ToUnreal(In.TotalDownloadSize); + Out.CurrentlyDownloadedBytes = ToUnreal(In.CurrentlyDownloadedBytes); + Out.TotalExtractedSizeOnDisk = ToUnreal(In.TotalExtractedSizeOnDisk); + Out.ID = ToUnreal(In.ID); + return Out; +} diff --git a/Source/Modio/Private/Internal/Convert/ModStats.h b/Source/Modio/Private/Internal/Convert/ModStats.h new file mode 100644 index 00000000..2574e329 --- /dev/null +++ b/Source/Modio/Private/Internal/Convert/ModStats.h @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once +#include "Internal/ModioConvert.h" +#include "ModioSDK.h" +#include "Types/ModioModStats.h" + +FORCEINLINE FModioModStats ToUnreal(const Modio::ModStats& In) +{ + FModioModStats Out; + Out.PopularityRankPosition = ToUnreal(In.PopularityRankPosition); + Out.PopularityRankTotalMods = ToUnreal(In.PopularityRankTotalMods); + Out.DownloadsTotal = ToUnreal(In.DownloadsTotal); + Out.SubscribersTotal = ToUnreal(In.SubscribersTotal); + Out.RatingTotal = ToUnreal(In.RatingTotal); + Out.RatingPositive = ToUnreal(In.RatingPositive); + Out.RatingNegative = ToUnreal(In.RatingNegative); + Out.RatingPercentagePositive = ToUnreal(In.RatingPercentagePositive); + Out.RatingWeightedAggregate = ToUnreal(In.RatingWeightedAggregate); + Out.RatingDisplayText = ToUnreal(In.RatingDisplayText); + return Out; +} diff --git a/Source/Modio/Private/Internal/Convert/ModTag.h b/Source/Modio/Private/Internal/Convert/ModTag.h new file mode 100644 index 00000000..0f576491 --- /dev/null +++ b/Source/Modio/Private/Internal/Convert/ModTag.h @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once +#include "Internal/ModioConvert.h" +#include "ModioSDK.h" +#include "Types/ModioModTag.h" + +FORCEINLINE FModioModTag ToUnreal(const Modio::ModTag& In) +{ + FModioModTag Out; + Out.Tag = ToUnreal(In.Tag); + return Out; +} \ No newline at end of file diff --git a/Source/Modio/Private/Internal/Convert/ModTagInfo.h b/Source/Modio/Private/Internal/Convert/ModTagInfo.h new file mode 100644 index 00000000..99de13d9 --- /dev/null +++ b/Source/Modio/Private/Internal/Convert/ModTagInfo.h @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once +#include "Internal/ModioConvert.h" +#include "ModioSDK.h" +#include "Types/ModioModTagInfo.h" + +FORCEINLINE FModioModTagInfo ToUnreal(const Modio::ModTagInfo& In) +{ + FModioModTagInfo Out; + Out.TagGroupName = ToUnreal(In.TagGroupName); + Out.TagGroupValues = ToUnreal(In.TagGroupValues); + Out.bAllowMultipleSelection = ToUnreal(In.bAllowMultipleSelection); + return Out; +} \ No newline at end of file diff --git a/Source/Modio/Private/Internal/Convert/ModTagOptions.h b/Source/Modio/Private/Internal/Convert/ModTagOptions.h new file mode 100644 index 00000000..e26110b4 --- /dev/null +++ b/Source/Modio/Private/Internal/Convert/ModTagOptions.h @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once +#pragma once + +#include "ModioSDK.h" +#include "Types/ModioModTagOptions.h" + +FORCEINLINE FModioModTagOptions ToUnreal(const Modio::ModTagOptions& In) +{ + return FModioModTagOptions(In); +} \ No newline at end of file diff --git a/Source/Modio/Private/Internal/Convert/Rating.h b/Source/Modio/Private/Internal/Convert/Rating.h new file mode 100644 index 00000000..a5a1f8fa --- /dev/null +++ b/Source/Modio/Private/Internal/Convert/Rating.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once +#include "ModioSDK.h" +#include "Types/ModioRating.h" + +/// I'd love to just use a static_cast after checking that the value is within the range of the target enum +/// but UE4 doesn't allow signed UENUMS at the present time +/// So a manual switch it is +FORCEINLINE Modio::Rating ToModio(const EModioRating In) +{ + switch (In) + { + case EModioRating::Negative: + return Modio::Rating::Negative; + break; + case EModioRating::Neutral: + return Modio::Rating::Neutral; + break; + case EModioRating::Positive: + return Modio::Rating::Positive; + break; + } + checkf(false, TEXT("EModioRating value was outside the range of expected values")); + return Modio::Rating::Neutral; +} \ No newline at end of file diff --git a/Source/Modio/Private/Internal/Convert/ReportParams.h b/Source/Modio/Private/Internal/Convert/ReportParams.h new file mode 100644 index 00000000..99ce9288 --- /dev/null +++ b/Source/Modio/Private/Internal/Convert/ReportParams.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once +#include "Internal/ModioConvert.h" +#include "ModioSDK.h" +#include "Types/ModioReportParams.h" + +FORCEINLINE Modio::ReportType ToModio(const EModioReportType& In) +{ + return static_cast(In); +} + +FORCEINLINE Modio::ReportParams ToModio(const FModioReportParams& In) +{ + Modio::Optional ReporterName; + Modio::Optional ReporterContact; + + if (In.ReporterName && !In.ReporterName->TrimStartAndEnd().IsEmpty()) + { + ReporterName = ToSTD(In.ReporterName.GetValue()); + } + + if (In.ReporterContact && !In.ReporterContact->TrimStartAndEnd().IsEmpty()) + { + ReporterContact = ToSTD(In.ReporterContact.GetValue()); + } + + switch (In.ReportedResourceType) + { + case FModioReportParams::ResourceType::Game: + return Modio::ReportParams(Modio::GameID(In.ResourceID), ToModio(In.Type), ToSTD(In.ReportDescription), + ReporterName, ReporterContact); + break; + case FModioReportParams::ResourceType::Mod: + return Modio::ReportParams(Modio::ModID(In.ResourceID), ToModio(In.Type), ToSTD(In.ReportDescription), + ReporterName, ReporterContact); + break; + case FModioReportParams::ResourceType::User: + return Modio::ReportParams(Modio::UserID(In.ResourceID), ToModio(In.Type), ToSTD(In.ReportDescription), + ReporterName, ReporterContact); + break; + } + // There's no sensible default for reported resource type, so returning params with empty description should trip + // the data validation checks on the server and give them the response we want + return Modio::ReportParams(Modio::GameID(-1), ToModio(In.Type), "", {}, {}); +} diff --git a/Source/Modio/Private/Internal/Convert/Terms.h b/Source/Modio/Private/Internal/Convert/Terms.h new file mode 100644 index 00000000..f8b8cdc6 --- /dev/null +++ b/Source/Modio/Private/Internal/Convert/Terms.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once + +#include "ModioSDK.h" +#include "Types/ModioTerms.h" +#include "Internal/ModioConvert.h" + +FORCEINLINE FModioLink ToUnreal(const Modio::Terms::Link& In) +{ + FModioLink Out; + Out.Text = ToUnreal(In.Text); + Out.URL = ToUnreal(In.URL); + Out.bRequired = ToUnreal(In.bRequired); + return Out; +} + +FORCEINLINE FModioTerms ToUnreal(const Modio::Terms& In) +{ + FModioTerms Out; + Out.AgreeButtonText = ToUnreal(In.Buttons.AgreeText); + Out.DisagreeButtonText = ToUnreal(In.Buttons.DisagreeText); + Out.WebsiteLink = ToUnreal(In.Links.Website); + Out.TermsLink = ToUnreal(In.Links.Terms); + Out.PrivacyLink = ToUnreal(In.Links.Privacy); + Out.ManageLink = ToUnreal(In.Links.Manage); + Out.TermsText = ToUnreal(In.TermsText); + return Out; +} \ No newline at end of file diff --git a/Source/Modio/Private/Internal/Convert/URLList.h b/Source/Modio/Private/Internal/Convert/URLList.h new file mode 100644 index 00000000..58120252 --- /dev/null +++ b/Source/Modio/Private/Internal/Convert/URLList.h @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once +#include "ModioSDK.h" +#include "Types/ModioURLList.h" + +FORCEINLINE FModioYoutubeURLList ToUnreal(const Modio::YoutubeURLList& In) +{ + return FModioYoutubeURLList(In); +} + + +FORCEINLINE FModioSketchfabURLList ToUnreal(const Modio::SketchfabURLList& In) +{ + return FModioSketchfabURLList(In); +} \ No newline at end of file diff --git a/Source/Modio/Private/Internal/Convert/User.h b/Source/Modio/Private/Internal/Convert/User.h new file mode 100644 index 00000000..32724913 --- /dev/null +++ b/Source/Modio/Private/Internal/Convert/User.h @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once + +#include "Internal/ModioConvert.h" +#include "ModioSDK.h" +#include "Types/ModioUser.h" +#include "Types/ModioCommonTypes.h" + +FORCEINLINE FModioUser ToUnreal(const Modio::User& In) { + FModioUser Out; + Out.UserId = FModioUserID(ToUnreal(In.UserId)); + Out.Username = ToUnreal(In.Username); + Out.DateOnline = ToUnreal(In.DateOnline); + Out.ProfileUrl = ToUnreal(In.ProfileUrl); + return Out; +} \ No newline at end of file diff --git a/Source/Modio/Private/Internal/ModioConvert.h b/Source/Modio/Private/Internal/ModioConvert.h new file mode 100644 index 00000000..7105d339 --- /dev/null +++ b/Source/Modio/Private/Internal/ModioConvert.h @@ -0,0 +1,384 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once + +#include "Containers/StringConv.h" +#include "Containers/UnrealString.h" +#include "Internal/ModioPrivateDefines.h" +#include "Misc/DateTime.h" +#include "ModioSDK.h" +#include "Types/ModioCommonTypes.h" +#include +#include +#include + +FORCEINLINE std::string ToSTD(const FString& String); +FORCEINLINE std::vector ToSTD(const TArray& StringArray); +FORCEINLINE std::chrono::system_clock::time_point ToSTD(FDateTime Time); + +// @todo: Make a ToModio that handles TOptional through templates + +FORCEINLINE int64 ToUnreal(std::int64_t Value); +FORCEINLINE uint8 ToUnreal(std::uint8_t Value); +FORCEINLINE double ToUnreal(double Value); +FORCEINLINE bool ToUnreal(bool Value); +FORCEINLINE uint64 ToUnreal(std::size_t Value); +FORCEINLINE FString ToUnreal(const std::string& String); +FORCEINLINE FString ToUnreal(const Modio::filesystem::path& Path); +FORCEINLINE FDateTime ToUnrealDateTime(std::int64_t UnixTimestamp); + +template +FORCEINLINE TArray ToUnreal(std::vector&& OriginalArray); + +template +FORCEINLINE TArray ToUnreal(const std::vector& OriginalArray); + +template +FORCEINLINE std::vector ToModio(const TArray& OriginalArray); + +FORCEINLINE Modio::ApiKey ToModio(const FModioApiKey& In); + +FORCEINLINE Modio::EmailAddress ToModio(const FModioEmailAddress& In); + +FORCEINLINE Modio::EmailAuthCode ToModio(const FModioEmailAuthCode& In); + +FORCEINLINE Modio::ModID ToModio(const FModioModID& In); +FORCEINLINE Modio::GameID ToModio(const FModioGameID& In); +FORCEINLINE Modio::FileMetadataID ToModio(const FModioFileMetadataID& In); +FORCEINLINE Modio::UserID ToModio(const FModioUserID& In); + +#pragma region Implementation + +// @todo: Rename this to ToModio as it doesn't matter that it's the part of STD of modio +FORCEINLINE std::string ToSTD(const FString& String) +{ + return std::string(TCHAR_TO_UTF8(*String)); +} + +// @todo: Rename this to ToModio as it doesn't matter that it's the part of STD of modio +FORCEINLINE std::vector ToSTD(const TArray& StringArray) +{ + std::vector Result; + Result.reserve(StringArray.Num()); + for (const FString& It : StringArray) + { + Result.emplace_back(TCHAR_TO_UTF8(*It)); + } + return Result; +} + +// @todo: Rename this to ToModio as it doesn't matter that it's the part of STD of modio +FORCEINLINE std::chrono::system_clock::time_point ToSTD(FDateTime Time) +{ + // @todonow: Verify that this becomes correct by printf debugging + return std::chrono::system_clock::time_point(std::chrono::system_clock::duration(Time.ToUnixTimestamp())); +} + +FORCEINLINE int64 ToUnreal(std::int64_t Value) +{ + return Value; +} + +FORCEINLINE bool ToUnreal(bool Value) +{ + return Value; +} + +FORCEINLINE uint8 ToUnreal(std::uint8_t Value) +{ + return Value; +} + +FORCEINLINE double ToUnreal(double Value) +{ + return Value; +} + +FORCEINLINE uint64 ToUnreal(std::size_t Value) +{ + static_assert(sizeof(std::size_t) == sizeof(uint64), "size_t is not 64-bits wide. Are you in x64 configuration?"); + return Value; +} + +FString ToUnreal(const std::string& String) +{ + return UTF8_TO_TCHAR(String.c_str()); +} + +FORCEINLINE FString ToUnreal(const Modio::filesystem::path& Path) +{ + return UTF8_TO_TCHAR(Path.generic_u8string().c_str()); +} + +FORCEINLINE FDateTime ToUnrealDateTime(std::int64_t UnixTimestamp) +{ + return FDateTime::FromUnixTimestamp(UnixTimestamp); +} + +template +TArray ToUnreal(std::vector&& OriginalArray) +{ + TArray Result; + + Result.Reserve(OriginalArray.size()); + for (auto& It : OriginalArray) + { + Result.Emplace(ToUnreal(MoveTemp(It))); + } + + return Result; +} + +template +TArray ToUnreal(const std::vector& OriginalArray) +{ + TArray Result; + + Result.Reserve(OriginalArray.size()); + for (const auto& It : OriginalArray) + { + Result.Emplace(ToUnreal(It)); + } + + return Result; +} + +template +std::vector ToModio(const TArray& OriginalArray) +{ + std::vector Out; + Out.reserve(OriginalArray.Num()); + for (const SourceValueType& Element : OriginalArray) + { + Out.emplace_back(ToModio(Element)); + } + return Out; +} + +FORCEINLINE Modio::ApiKey ToModio(const FModioApiKey& In) +{ + return Modio::ApiKey(TCHAR_TO_UTF8(*In.ToString())); +} + +FORCEINLINE Modio::EmailAddress ToModio(const FModioEmailAddress& In) +{ + return Modio::EmailAddress(TCHAR_TO_UTF8(*In.ToString())); +} + +FORCEINLINE Modio::EmailAuthCode ToModio(const FModioEmailAuthCode& In) +{ + return Modio::EmailAuthCode(TCHAR_TO_UTF8(*In.ToString())); +} + +FORCEINLINE Modio::ModID ToModio(const FModioModID& In) +{ + return Modio::ModID(In.ModID); +} + +FORCEINLINE Modio::GameID ToModio(const FModioGameID& In) +{ + return Modio::GameID(In.GameID); +} +FORCEINLINE Modio::FileMetadataID ToModio(const FModioFileMetadataID& In) +{ + return Modio::FileMetadataID(In.FileMetadataID); +} +FORCEINLINE Modio::UserID ToModio(const FModioUserID& In) +{ + return Modio::UserID(In.UserID); +} + +FORCEINLINE FModioModID ToUnreal(Modio::ModID Value); +FORCEINLINE FModioFileMetadataID ToUnreal(Modio::FileMetadataID Value); + +FORCEINLINE Modio::LogLevel ToModio(EModioLogLevel UnrealLogLevel); +FORCEINLINE Modio::AvatarSize ToModio(EModioAvatarSize AvatarSize); +FORCEINLINE Modio::GallerySize ToModio(EModioGallerySize GallerySize); +FORCEINLINE Modio::LogoSize ToModio(EModioLogoSize LogoSize); +FORCEINLINE Modio::Environment ToModio(EModioEnvironment Environment); +FORCEINLINE Modio::Portal ToModio(EModioPortal Portal); + +#pragma region ToModio implementation + +MODIO_BEGIN_CONVERT_SWITCHES + +Modio::LogLevel ToModio(EModioLogLevel UnrealLogLevel) +{ + switch (UnrealLogLevel) + { + case EModioLogLevel::Error: + return Modio::LogLevel::Error; + case EModioLogLevel::Info: + return Modio::LogLevel::Info; + case EModioLogLevel::Trace: + return Modio::LogLevel::Trace; + case EModioLogLevel::Warning: + return Modio::LogLevel::Warning; + } + + checkf(false, TEXT("Missed a case in ToModio(EModioLogLevel UnrealLogLevel)")); + return Modio::LogLevel::Info; +} + +Modio::AvatarSize ToModio(EModioAvatarSize AvatarSize) +{ + switch (AvatarSize) + { + case EModioAvatarSize::Original: + return Modio::AvatarSize::Original; + case EModioAvatarSize::Thumb50: + return Modio::AvatarSize::Thumb50; + case EModioAvatarSize::Thumb100: + return Modio::AvatarSize::Thumb100; + } + + checkf(false, TEXT("Missed a case in ToModio(EModioAvatarSize AvatarSize)")); + return Modio::AvatarSize::Thumb50; +} + +Modio::GallerySize ToModio(EModioGallerySize GallerySize) +{ + switch (GallerySize) + { + case EModioGallerySize::Original: + return Modio::GallerySize::Original; + case EModioGallerySize::Thumb320: + return Modio::GallerySize::Thumb320; + } + + checkf(false, TEXT("Missed a case in ToModio(EModioGallerySize GallerySize)")); + return Modio::GallerySize::Thumb320; +} + +Modio::LogoSize ToModio(EModioLogoSize LogoSize) +{ + switch (LogoSize) + { + case EModioLogoSize::Original: + return Modio::LogoSize::Original; + case EModioLogoSize::Thumb320: + return Modio::LogoSize::Thumb320; + case EModioLogoSize::Thumb640: + return Modio::LogoSize::Thumb640; + case EModioLogoSize::Thumb1280: + return Modio::LogoSize::Thumb1280; + } + + checkf(false, TEXT("Missed a case in ToModio(EModioLogoSize LogoSize)")); + return Modio::LogoSize::Thumb320; +} + +Modio::Environment ToModio(EModioEnvironment Environment) +{ + switch (Environment) + { + case EModioEnvironment::Test: + return Modio::Environment::Test; + case EModioEnvironment::Live: + return Modio::Environment::Live; + } + + checkf(false, TEXT("Missed a case in ToModio(EModioEnvironment Environment)")); + return Modio::Environment::Test; +} + +Modio::Portal ToModio(EModioPortal Portal) +{ + switch (Portal) + { + case EModioPortal::None: + return Modio::Portal::None; + break; + case EModioPortal::Apple: + return Modio::Portal::Apple; + break; + case EModioPortal::EpicGamesStore: + return Modio::Portal::EpicGamesStore; + break; + case EModioPortal::GOG: + return Modio::Portal::GOG; + break; + case EModioPortal::Google: + return Modio::Portal::Google; + break; + case EModioPortal::Itchio: + return Modio::Portal::Itchio; + break; + case EModioPortal::Nintendo: + return Modio::Portal::Nintendo; + break; + case EModioPortal::PSN: + return Modio::Portal::PSN; + break; + case EModioPortal::Steam: + return Modio::Portal::Steam; + break; + case EModioPortal::XboxLive: + return Modio::Portal::XboxLive; + break; + } + checkf(false, TEXT("Missed a case in ToModio(EModioPortal)")); + return Modio::Portal::None; +} + +FORCEINLINE Modio::Language ToModio(EModioLanguage Language) +{ + switch (Language) + { + case EModioLanguage::English: + return Modio::Language::English; + case EModioLanguage::Bulgarian: + return Modio::Language::Bulgarian; + case EModioLanguage::French: + return Modio::Language::French; + case EModioLanguage::German: + return Modio::Language::German; + case EModioLanguage::Italian: + return Modio::Language::Italian; + case EModioLanguage::Polish: + return Modio::Language::Polish; + case EModioLanguage::Portuguese: + return Modio::Language::Portuguese; + case EModioLanguage::Hungarian: + return Modio::Language::Hungarian; + case EModioLanguage::Japanese: + return Modio::Language::Japanese; + case EModioLanguage::Korean: + return Modio::Language::Korean; + case EModioLanguage::Russian: + return Modio::Language::Russian; + case EModioLanguage::Spanish: + return Modio::Language::Spanish; + case EModioLanguage::Thai: + return Modio::Language::Thai; + case EModioLanguage::ChineseSimplified: + return Modio::Language::ChineseSimplified; + case EModioLanguage::ChineseTraditional: + return Modio::Language::ChineseTraditional; + } + + checkf(false, TEXT("Missed a case in ToModio(EModioLanguage Language)")); + return Modio::Language::English; +} + +MODIO_END_CONVERT_SWITCHES + +FModioModID ToUnreal(Modio::ModID Value) +{ + return FModioModID(Value); +} + +FModioFileMetadataID ToUnreal(Modio::FileMetadataID Value) +{ + return FModioFileMetadataID(Value); +} + +#pragma endregion diff --git a/Source/Modio/Private/Internal/ModioPrivateDefines.h b/Source/Modio/Private/Internal/ModioPrivateDefines.h new file mode 100644 index 00000000..44422c85 --- /dev/null +++ b/Source/Modio/Private/Internal/ModioPrivateDefines.h @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once + +// This makes missing a value in the switch statement a fatal error, is disabled after our conversion routines +#define MODIO_BEGIN_CONVERT_SWITCHES \ + __pragma(warning(push)) \ + __pragma(warning(error : 4062)) + +#define MODIO_END_CONVERT_SWITCHES \ + __pragma(warning(pop)) diff --git a/Source/Modio/Private/Libraries/ModioCommonTypesLibrary.cpp b/Source/Modio/Private/Libraries/ModioCommonTypesLibrary.cpp index ad71e8fd..1cb957f7 100644 --- a/Source/Modio/Private/Libraries/ModioCommonTypesLibrary.cpp +++ b/Source/Modio/Private/Libraries/ModioCommonTypesLibrary.cpp @@ -1,9 +1,19 @@ -#include "Libraries/ModioCommonTypesLibrary.h" +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#include "Libraries/ModioCommonTypesLibrary.h" #include "Types/ModioAuthenticationParams.h" FModioGameID UModioCommonTypesLibrary::MakeGameId(int64 GameId) { - return FModioGameID(Modio::GameID(GameId)); + return FModioGameID(GameId); } FString UModioCommonTypesLibrary::Conv_GameIDToString(FModioGameID GameId) @@ -66,8 +76,8 @@ FString UModioCommonTypesLibrary::Conv_UserIDToString(FModioUserID UserID) FModioInitializeOptions UModioCommonTypesLibrary::MakeInitializeOptions(int64 GameId, const FString& APIKey, EModioEnvironment GameEnvironment, EModioPortal PortalInUse) { FModioInitializeOptions Options; - Options.GameID = FModioGameID(GameId); - Options.APIKey = FModioApiKey(APIKey); + Options.GameId = FModioGameID(GameId); + Options.ApiKey = FModioApiKey(APIKey); Options.GameEnvironment = GameEnvironment; Options.PortalInUse = PortalInUse; return Options; diff --git a/Source/Modio/Private/Libraries/ModioErrorCodeLibrary.cpp b/Source/Modio/Private/Libraries/ModioErrorCodeLibrary.cpp index c5b94315..68e3bac0 100644 --- a/Source/Modio/Private/Libraries/ModioErrorCodeLibrary.cpp +++ b/Source/Modio/Private/Libraries/ModioErrorCodeLibrary.cpp @@ -1,4 +1,14 @@ -#include "Libraries/ModioErrorCodeLibrary.h" +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#include "Libraries/ModioErrorCodeLibrary.h" bool UModioErrorCodeLibrary::IsError(const FModioErrorCode& Error) { diff --git a/Source/Modio/Private/Libraries/ModioErrorConditionLibrary.cpp b/Source/Modio/Private/Libraries/ModioErrorConditionLibrary.cpp new file mode 100644 index 00000000..550cd05d --- /dev/null +++ b/Source/Modio/Private/Libraries/ModioErrorConditionLibrary.cpp @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#include "Libraries/ModioErrorConditionLibrary.h" +#include "ModioSDK.h" + +bool UModioErrorConditionLibrary::ErrorCodeMatches(FModioErrorCode ErrorCode, EModioErrorCondition Condition) +{ + if (Condition == EModioErrorCondition::NoError) + { + return (bool) ErrorCode.GetRawErrorCode(); + } + return Modio::ErrorCodeMatches(ErrorCode.GetRawErrorCode(), static_cast(Condition)); +} diff --git a/Source/Modio/Private/Libraries/ModioFilterParamsLibrary.cpp b/Source/Modio/Private/Libraries/ModioFilterParamsLibrary.cpp index ce8436fe..3a64591c 100644 --- a/Source/Modio/Private/Libraries/ModioFilterParamsLibrary.cpp +++ b/Source/Modio/Private/Libraries/ModioFilterParamsLibrary.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #include "Libraries/ModioFilterParamsLibrary.h" FModioFilterParams& UModioFilterParamsLibrary::SortBy(FModioFilterParams& Filter, EModioSortFieldType ByField, diff --git a/Source/Modio/Private/Libraries/ModioImageLibrary.cpp b/Source/Modio/Private/Libraries/ModioImageLibrary.cpp index 546505d0..1758adba 100644 --- a/Source/Modio/Private/Libraries/ModioImageLibrary.cpp +++ b/Source/Modio/Private/Libraries/ModioImageLibrary.cpp @@ -1,4 +1,14 @@ -#include "Libraries/ModioImageLibrary.h" +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#include "Libraries/ModioImageLibrary.h" #include "Engine/Texture.h" #include "Internal/ModioPrivateDefines.h" diff --git a/Source/Modio/Private/Libraries/ModioModCollectionLibrary.cpp b/Source/Modio/Private/Libraries/ModioModCollectionLibrary.cpp index 167432bd..5f2708a6 100644 --- a/Source/Modio/Private/Libraries/ModioModCollectionLibrary.cpp +++ b/Source/Modio/Private/Libraries/ModioModCollectionLibrary.cpp @@ -1,4 +1,14 @@ -#include "Libraries/ModioModCollectionLibrary.h" +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#include "Libraries/ModioModCollectionLibrary.h" EModioModState UModioModCollectionLibrary::GetModState(const FModioModCollectionEntry& Entry) { @@ -15,7 +25,7 @@ const FModioModInfo& UModioModCollectionLibrary::GetModProfile(const FModioModCo return Entry.GetModProfile(); } -const FString& UModioModCollectionLibrary::GetPath(const FModioModCollectionEntry& Entry) +const FString UModioModCollectionLibrary::GetPath(const FModioModCollectionEntry& Entry) { return Entry.GetPath(); } diff --git a/Source/Modio/Private/Libraries/ModioModInfoListLibrary.cpp b/Source/Modio/Private/Libraries/ModioModInfoListLibrary.cpp index 345f2e28..b7086cdb 100644 --- a/Source/Modio/Private/Libraries/ModioModInfoListLibrary.cpp +++ b/Source/Modio/Private/Libraries/ModioModInfoListLibrary.cpp @@ -1,4 +1,14 @@ -#include "Libraries/ModioModInfoListLibrary.h" +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#include "Libraries/ModioModInfoListLibrary.h" const TArray& UModioModInfoListLibrary::GetMods(const FModioModInfoList& ModInfoList) { diff --git a/Source/Modio/Private/Libraries/ModioModTagOptionsLibrary.cpp b/Source/Modio/Private/Libraries/ModioModTagOptionsLibrary.cpp index 29187001..79781e76 100644 --- a/Source/Modio/Private/Libraries/ModioModTagOptionsLibrary.cpp +++ b/Source/Modio/Private/Libraries/ModioModTagOptionsLibrary.cpp @@ -1,4 +1,14 @@ -#include "Libraries/ModioModTagOptionsLibrary.h" +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#include "Libraries/ModioModTagOptionsLibrary.h" const TArray& UModioModTagOptionsLibrary::GetTags(const FModioModTagOptions& ModTags) { diff --git a/Source/Modio/Private/Libraries/ModioOptionalLibrary.cpp b/Source/Modio/Private/Libraries/ModioOptionalLibrary.cpp index 5b4bea18..a78e95c2 100644 --- a/Source/Modio/Private/Libraries/ModioOptionalLibrary.cpp +++ b/Source/Modio/Private/Libraries/ModioOptionalLibrary.cpp @@ -1,4 +1,14 @@ -#include "Libraries/ModioOptionalLibrary.h" +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#include "Libraries/ModioOptionalLibrary.h" #include "Types/ModioModInfoList.h" #include "Types/ModioModTagOptions.h" #include "Types/ModioUser.h" diff --git a/Source/Modio/Private/Libraries/ModioReportLibrary.cpp b/Source/Modio/Private/Libraries/ModioReportLibrary.cpp new file mode 100644 index 00000000..24bf9339 --- /dev/null +++ b/Source/Modio/Private/Libraries/ModioReportLibrary.cpp @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +// Fill out your copyright notice in the Description page of Project Settings. + +#include "Libraries/ModioReportLibrary.h" +#include "Types/ModioCommonTypes.h" + +FModioReportParams UModioReportLibrary::MakeReportForGame(FModioGameID Game, EModioReportType Type, + FString ReportDescription, FString ReporterName, + FString ReporterContact) +{ + return FModioReportParams(Game, Type, ReportDescription, ReporterName, ReporterContact); +} + +FModioReportParams UModioReportLibrary::MakeReportForUser(FModioUserID User, EModioReportType Type, + FString ReportDescription, FString ReporterName, + FString ReporterContact) +{ + return FModioReportParams(User, Type, ReportDescription, ReporterName, ReporterContact); +} + +FModioReportParams UModioReportLibrary::MakeReportForMod(FModioModID Mod, EModioReportType Type, + FString ReportDescription, FString ReporterName, + FString ReporterContact) +{ + return FModioReportParams(Mod, Type, ReportDescription, ReporterName, ReporterContact); +} diff --git a/Source/Modio/Private/Libraries/ModioSDKLibrary.cpp b/Source/Modio/Private/Libraries/ModioSDKLibrary.cpp index 6b72393a..9516b3a3 100644 --- a/Source/Modio/Private/Libraries/ModioSDKLibrary.cpp +++ b/Source/Modio/Private/Libraries/ModioSDKLibrary.cpp @@ -1,4 +1,14 @@ -#include "Libraries/ModioSDKLibrary.h" +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#include "Libraries/ModioSDKLibrary.h" #include "ModioSettings.h" #include "Internationalization/Regex.h" @@ -22,9 +32,9 @@ FModioInitializeOptions UModioSDKLibrary::GetProjectInitializeOptions() const UModioSettings* Settings = GetDefault(); FModioInitializeOptions Options; - Options.APIKey = FModioApiKey(Settings->ApiKey); + Options.ApiKey = FModioApiKey(Settings->ApiKey); Options.GameEnvironment = Settings->Environment; - Options.GameID = FModioGameID(Settings->GameId); + Options.GameId = FModioGameID(Settings->GameId); return Options; } diff --git a/Source/Modio/Private/Modio.cpp b/Source/Modio/Private/Modio.cpp index 601ff791..f4815473 100644 --- a/Source/Modio/Private/Modio.cpp +++ b/Source/Modio/Private/Modio.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #include "Modio.h" DEFINE_LOG_CATEGORY(LogModio) \ No newline at end of file diff --git a/Source/Modio/Private/ModioImageCache.cpp b/Source/Modio/Private/ModioImageCache.cpp index a5b2e2a8..99febe97 100644 --- a/Source/Modio/Private/ModioImageCache.cpp +++ b/Source/Modio/Private/ModioImageCache.cpp @@ -1,4 +1,14 @@ -#include "ModioImageCache.h" +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#include "ModioImageCache.h" #include "Engine/Texture2DDynamic.h" bool FModioImageCache::IsStaleState(const FImageState& State) const diff --git a/Source/Modio/Private/ModioModule.cpp b/Source/Modio/Private/ModioModule.cpp index 25fde92d..0476c2d9 100644 --- a/Source/Modio/Private/ModioModule.cpp +++ b/Source/Modio/Private/ModioModule.cpp @@ -1,4 +1,13 @@ - +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. #include "ModioModule.h" diff --git a/Source/Modio/Private/ModioModule.h b/Source/Modio/Private/ModioModule.h index 496638c7..17e120ca 100644 --- a/Source/Modio/Private/ModioModule.h +++ b/Source/Modio/Private/ModioModule.h @@ -1,4 +1,14 @@ -#pragma once +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once #include "Modules/ModuleManager.h" diff --git a/Source/Modio/Private/ModioPrivatePCH.h b/Source/Modio/Private/ModioPrivatePCH.h index ccc9896d..d77ffa2b 100644 --- a/Source/Modio/Private/ModioPrivatePCH.h +++ b/Source/Modio/Private/ModioPrivatePCH.h @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #pragma once //#include "ModioSDK.h" diff --git a/Source/Modio/Private/ModioSettings.cpp b/Source/Modio/Private/ModioSettings.cpp index 0beb8f3a..3bdc22ed 100644 --- a/Source/Modio/Private/ModioSettings.cpp +++ b/Source/Modio/Private/ModioSettings.cpp @@ -1,4 +1,14 @@ -#include "ModioSettings.h" +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#include "ModioSettings.h" #include "Engine/Engine.h" #include "ModioSubsystem.h" diff --git a/Source/Modio/Private/ModioSubsystem.cpp b/Source/Modio/Private/ModioSubsystem.cpp index 364404bd..272d9c3c 100644 --- a/Source/Modio/Private/ModioSubsystem.cpp +++ b/Source/Modio/Private/ModioSubsystem.cpp @@ -1,5 +1,31 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #include "ModioSubsystem.h" #include "Engine/Engine.h" +#include "Internal/Convert/AuthParams.h" +#include "Internal/Convert/ErrorCode.h" +#include "Internal/Convert/FilterParams.h" +#include "Internal/Convert/InitializeOptions.h" +#include "Internal/Convert/ModCollectionEntry.h" +#include "Internal/Convert/ModInfo.h" +#include "Internal/Convert/ModInfoList.h" +#include "Internal/Convert/ModManagementEvent.h" +#include "Internal/Convert/ModProgressInfo.h" +#include "Internal/Convert/ModTagInfo.h" +#include "Internal/Convert/ModTagOptions.h" +#include "Internal/Convert/Rating.h" +#include "Internal/Convert/ReportParams.h" +#include "Internal/Convert/Terms.h" +#include "Internal/Convert/User.h" +#include "Internal/ModioConvert.h" #include "ModioSettings.h" #include @@ -38,7 +64,7 @@ bool UModioSubsystem::ShouldCreateSubsystem(UObject* Outer) const void UModioSubsystem::InitializeAsync(const FModioInitializeOptions& Options, FOnErrorOnlyDelegateFast OnInitComplete) { - Modio::InitializeAsync(Options, [this, OnInitComplete](Modio::ErrorCode ec) { + Modio::InitializeAsync(ToModio(Options), [this, OnInitComplete](Modio::ErrorCode ec) { InvalidateUserSubscriptionCache(); OnInitComplete.ExecuteIfBound(ToUnreal(ec)); @@ -54,14 +80,15 @@ void UModioSubsystem::K2_InitializeAsync(const FModioInitializeOptions& Initiali void UModioSubsystem::ListAllModsAsync(const FModioFilterParams& Filter, FOnListAllModsDelegateFast Callback) { - Modio::ListAllModsAsync(*Filter, [Callback](Modio::ErrorCode ec, Modio::Optional Result) { - Callback.ExecuteIfBound(ec, ToUnrealOptional(Result)); - }); + Modio::ListAllModsAsync(ToModio(Filter), + [Callback](Modio::ErrorCode ec, Modio::Optional Result) { + Callback.ExecuteIfBound(ec, ToUnrealOptional(Result)); + }); } void UModioSubsystem::SubscribeToModAsync(FModioModID ModToSubscribeTo, FOnErrorOnlyDelegateFast OnSubscribeComplete) { - Modio::SubscribeToModAsync(ModToSubscribeTo, [this, OnSubscribeComplete](Modio::ErrorCode ec) { + Modio::SubscribeToModAsync(ToModio(ModToSubscribeTo), [this, OnSubscribeComplete](Modio::ErrorCode ec) { InvalidateUserSubscriptionCache(); OnSubscribeComplete.ExecuteIfBound(ToUnreal(ec)); @@ -71,7 +98,7 @@ void UModioSubsystem::SubscribeToModAsync(FModioModID ModToSubscribeTo, FOnError void UModioSubsystem::UnsubscribeFromModAsync(FModioModID ModToUnsubscribeFrom, FOnErrorOnlyDelegateFast OnUnsubscribeComplete) { - Modio::UnsubscribeFromModAsync(ModToUnsubscribeFrom, [this, OnUnsubscribeComplete](Modio::ErrorCode ec) { + Modio::UnsubscribeFromModAsync(ToModio(ModToUnsubscribeFrom), [this, OnUnsubscribeComplete](Modio::ErrorCode ec) { InvalidateUserSubscriptionCache(); OnUnsubscribeComplete.ExecuteIfBound(ToUnreal(ec)); @@ -91,7 +118,7 @@ void UModioSubsystem::EnableModManagement(FOnModManagementDelegateFast Callback) Modio::EnableModManagement([this, Callback](Modio::ModManagementEvent Event) { // @todo: For some smarter caching, look at the event and see if we should invalidate the cache InvalidateUserInstallationCache(); - Callback.ExecuteIfBound(Event); + Callback.ExecuteIfBound(ToUnreal(Event)); }); } @@ -212,7 +239,7 @@ FModioOptionalUser UModioSubsystem::K2_QueryUserProfile() void UModioSubsystem::GetModInfoAsync(FModioModID ModId, FOnGetModInfoDelegateFast Callback) { - Modio::GetModInfoAsync(ModId, [Callback](Modio::ErrorCode ec, Modio::Optional ModInfo) { + Modio::GetModInfoAsync(ToModio(ModId), [Callback](Modio::ErrorCode ec, Modio::Optional ModInfo) { Callback.ExecuteIfBound(ec, ToUnrealOptional(ModInfo)); }); } @@ -227,26 +254,65 @@ void UModioSubsystem::K2_GetModInfoAsync(FModioModID ModId, FOnGetModInfoDelegat void UModioSubsystem::GetModMediaAsync(FModioModID ModId, EModioAvatarSize AvatarSize, FOnGetMediaDelegateFast Callback) { - Modio::GetModMediaAsync(ModId, ToModio(AvatarSize), + Modio::GetModMediaAsync(ToModio(ModId), ToModio(AvatarSize), [Callback](Modio::ErrorCode ec, Modio::Optional Path) { - Callback.ExecuteIfBound(ec, ToUnrealOptional(Path)); + // Manually calling ToUnreal on the path and assigning to the member of FModioImage + // because we already have a Modio::filesystem::path -> FString overload of ToUnreal + // TODO: @modio-ue4 Potentially refactor ToUnreal(Modio::filesystem::path) as a template + // function returning type T so we can be explicit about the expected type + if (Path) + { + FModioImage Out; + Out.ImagePath = ToUnreal(Path.value()); + Callback.ExecuteIfBound(ec, Out); + } + else + { + Callback.ExecuteIfBound(ec, {}); + } }); } void UModioSubsystem::GetModMediaAsync(FModioModID ModId, EModioGallerySize GallerySize, Modio::GalleryIndex Index, FOnGetMediaDelegateFast Callback) { - Modio::GetModMediaAsync(ModId, ToModio(GallerySize), Index, + Modio::GetModMediaAsync(ToModio(ModId), ToModio(GallerySize), Index, [Callback](Modio::ErrorCode ec, Modio::Optional Path) { - Callback.ExecuteIfBound(ec, ToUnrealOptional(Path)); + // Manually calling ToUnreal on the path and assigning to the member of FModioImage + // because we already have a Modio::filesystem::path -> FString overload of ToUnreal + // TODO: @modio-ue4 Potentially refactor ToUnreal(Modio::filesystem::path) as a template + // function returning type T so we can be explicit about the expected type + if (Path) + { + FModioImage Out; + Out.ImagePath = ToUnreal(Path.value()); + Callback.ExecuteIfBound(ec, Out); + } + else + { + Callback.ExecuteIfBound(ec, {}); + } }); } void UModioSubsystem::GetModMediaAsync(FModioModID ModId, EModioLogoSize LogoSize, FOnGetMediaDelegateFast Callback) { - Modio::GetModMediaAsync(ModId, ToModio(LogoSize), + Modio::GetModMediaAsync(ToModio(ModId), ToModio(LogoSize), [Callback](Modio::ErrorCode ec, Modio::Optional Path) { - Callback.ExecuteIfBound(ec, ToUnrealOptional(Path)); + // Manually calling ToUnreal on the path and assigning to the member of FModioImage + // because we already have a Modio::filesystem::path -> FString overload of ToUnreal + // TODO: @modio-ue4 Potentially refactor ToUnreal(Modio::filesystem::path) as a template + // function returning type T so we can be explicit about the expected type + if (Path) + { + FModioImage Out; + Out.ImagePath = ToUnreal(Path.value()); + Callback.ExecuteIfBound(ec, Out); + } + else + { + Callback.ExecuteIfBound(ec, {}); + } }); } @@ -305,7 +371,7 @@ void UModioSubsystem::K2_GetModTagOptionsAsync(FOnGetModTagOptionsDelegate Callb void UModioSubsystem::RequestEmailAuthCodeAsync(const FModioEmailAddress& EmailAddress, FOnErrorOnlyDelegateFast Callback) { - Modio::RequestEmailAuthCodeAsync(EmailAddress, + Modio::RequestEmailAuthCodeAsync(ToModio(EmailAddress), [Callback](Modio::ErrorCode ec) { Callback.ExecuteIfBound(ToUnreal(ec)); }); } @@ -319,7 +385,7 @@ void UModioSubsystem::K2_RequestEmailAuthCodeAsync(const FModioEmailAddress& Ema void UModioSubsystem::AuthenticateUserEmailAsync(const FModioEmailAuthCode& AuthenticationCode, FOnErrorOnlyDelegateFast Callback) { - Modio::AuthenticateUserEmailAsync(AuthenticationCode, + Modio::AuthenticateUserEmailAsync(ToModio(AuthenticationCode), [Callback](FModioErrorCode ec) { Callback.ExecuteIfBound(ec); }); } @@ -335,7 +401,7 @@ void UModioSubsystem::AuthenticateUserExternalAsync(const FModioAuthenticationPa EModioAuthenticationProvider Provider, FOnErrorOnlyDelegateFast Callback) { - Modio::AuthenticateUserExternalAsync(User, ToModio(Provider), + Modio::AuthenticateUserExternalAsync(ToModio(User), ToModio(Provider), [Callback](Modio::ErrorCode ec) { Callback.ExecuteIfBound(ec); }); } @@ -382,7 +448,20 @@ void UModioSubsystem::GetUserMediaAsync(EModioAvatarSize AvatarSize, FOnGetMedia { Modio::GetUserMediaAsync(ToModio(AvatarSize), [Callback](Modio::ErrorCode ec, Modio::Optional Media) { - Callback.ExecuteIfBound(ec, ToUnrealOptional(Media)); + // Manually calling ToUnreal on the path and assigning to the member of FModioImage + // because we already have a Modio::filesystem::path -> FString overload of ToUnreal + // TODO: @modio-ue4 Potentially refactor ToUnreal(Modio::filesystem::path) as a + // template function returning type T so we can be explicit about the expected type + if (Media) + { + FModioImage Out; + Out.ImagePath = ToUnreal(Media.value()); + Callback.ExecuteIfBound(ec, Out); + } + else + { + Callback.ExecuteIfBound(ec, {}); + } }); } @@ -427,7 +506,35 @@ TMap UModioSubsystem::QuerySystemInstalla void UModioSubsystem::ForceUninstallModAsync(FModioModID ModToRemove, FOnErrorOnlyDelegate Callback) { - Modio::ForceUninstallModAsync(ModToRemove, [Callback](FModioErrorCode ec) { Callback.ExecuteIfBound(ec); }); + Modio::ForceUninstallModAsync(ToModio(ModToRemove), + [Callback](FModioErrorCode ec) { Callback.ExecuteIfBound(ec); }); +} + +void UModioSubsystem::SubmitModRatingAsync(FModioModID Mod, EModioRating Rating, + FOnErrorOnlyDelegateFast Callback) +{ + Modio::SubmitModRatingAsync(ToModio(Mod), ToModio(Rating), + [Callback](FModioErrorCode ec) { Callback.ExecuteIfBound(ec); }); +} + +void UModioSubsystem::K2_SubmitModRatingAsync(FModioModID Mod, EModioRating Rating, + FOnErrorOnlyDelegate Callback) +{ + SubmitModRatingAsync(Mod, Rating, FOnErrorOnlyDelegateFast::CreateLambda([Callback](FModioErrorCode ec) { + Callback.ExecuteIfBound(ec); + })); +} + +void UModioSubsystem::ReportContentAsync(FModioReportParams Report, FOnErrorOnlyDelegateFast Callback) +{ + Modio::ReportContentAsync(ToModio(Report), [Callback](FModioErrorCode ec) { Callback.ExecuteIfBound(ec); }); +} + +void UModioSubsystem::K2_ReportContentAsync(FModioReportParams Report, FOnErrorOnlyDelegate Callback) +{ + ReportContentAsync(Report, FOnErrorOnlyDelegateFast::CreateLambda( + [Callback](FModioErrorCode ec) { Callback.ExecuteIfBound(ec); })); + } /// File scope implementations @@ -441,7 +548,7 @@ TMap ToUnreal(std::map&& OriginalMap Result.Reserve(OriginalMap.size()); for (auto& It : OriginalMap) { - Result.Add(*reinterpret_cast(&It.first), DestValue(MoveTemp(It.second))); + Result.Add(ToUnreal(It.first), ToUnreal(It.second)); } return Result; @@ -453,7 +560,7 @@ TOptional ToUnrealOptional(Source Original) TOptional DestinationOptional = {}; if (Original) { - DestinationOptional = Dest(*Original); + DestinationOptional = ToUnreal(Original.value()); } return DestinationOptional; diff --git a/Source/Modio/Private/Tests/Commands/AuthoriseUserEmailAsync.h b/Source/Modio/Private/Tests/Commands/AuthoriseUserEmailAsync.h index fbd13064..3235c9e7 100644 --- a/Source/Modio/Private/Tests/Commands/AuthoriseUserEmailAsync.h +++ b/Source/Modio/Private/Tests/Commands/AuthoriseUserEmailAsync.h @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #pragma once #include "ModioSubsystem.h" #include "Tests/Commands/ModioTestCommandBase.h" diff --git a/Source/Modio/Private/Tests/Commands/DisableModManagement.h b/Source/Modio/Private/Tests/Commands/DisableModManagement.h index aa7bf006..07aafb4e 100644 --- a/Source/Modio/Private/Tests/Commands/DisableModManagement.h +++ b/Source/Modio/Private/Tests/Commands/DisableModManagement.h @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #pragma once #include "ModioSubsystem.h" #include "Tests/Commands/ModioTestCommandBase.h" diff --git a/Source/Modio/Private/Tests/Commands/EnableModManagement.h b/Source/Modio/Private/Tests/Commands/EnableModManagement.h index e9c9c0fa..aa407593 100644 --- a/Source/Modio/Private/Tests/Commands/EnableModManagement.h +++ b/Source/Modio/Private/Tests/Commands/EnableModManagement.h @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #pragma once #include "ModioSubsystem.h" #include "Tests/Commands/ModioTestCommandBase.h" diff --git a/Source/Modio/Private/Tests/Commands/FetchExternalUpdatesAsync.h b/Source/Modio/Private/Tests/Commands/FetchExternalUpdatesAsync.h index 9c622470..118f7cf2 100644 --- a/Source/Modio/Private/Tests/Commands/FetchExternalUpdatesAsync.h +++ b/Source/Modio/Private/Tests/Commands/FetchExternalUpdatesAsync.h @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #pragma once #include "ModioSubsystem.h" #include "Tests/Commands/ModioTestCommandBase.h" diff --git a/Source/Modio/Private/Tests/Commands/GetModInfoAsync.h b/Source/Modio/Private/Tests/Commands/GetModInfoAsync.h index 5b7efbab..cd7bb889 100644 --- a/Source/Modio/Private/Tests/Commands/GetModInfoAsync.h +++ b/Source/Modio/Private/Tests/Commands/GetModInfoAsync.h @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #pragma once #include "ModioSubsystem.h" #include "Tests/Commands/ModioTestCommandBase.h" diff --git a/Source/Modio/Private/Tests/Commands/GetModMediaAsync.h b/Source/Modio/Private/Tests/Commands/GetModMediaAsync.h index bef89f7d..dfe9e9bc 100644 --- a/Source/Modio/Private/Tests/Commands/GetModMediaAsync.h +++ b/Source/Modio/Private/Tests/Commands/GetModMediaAsync.h @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #pragma once #include "ModioSubsystem.h" diff --git a/Source/Modio/Private/Tests/Commands/InitializeAsync.h b/Source/Modio/Private/Tests/Commands/InitializeAsync.h index 655bf489..f44da0c0 100644 --- a/Source/Modio/Private/Tests/Commands/InitializeAsync.h +++ b/Source/Modio/Private/Tests/Commands/InitializeAsync.h @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #pragma once #include "ModioSubsystem.h" #include "Tests/Commands/ModioTestCommandBase.h" diff --git a/Source/Modio/Private/Tests/Commands/InitializeBadResponseAsync.h b/Source/Modio/Private/Tests/Commands/InitializeBadResponseAsync.h index 185e8e94..0e8c3dcf 100644 --- a/Source/Modio/Private/Tests/Commands/InitializeBadResponseAsync.h +++ b/Source/Modio/Private/Tests/Commands/InitializeBadResponseAsync.h @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #pragma once #include "ModioSubsystem.h" @@ -12,9 +22,9 @@ class FModioInitializeBadResponseAsyncCommand : public FModioTestLatentCommandBa virtual void Start() override { FModioInitializeOptions Opts; - Opts.APIKey = FModioApiKey("8d561adc585f3292356a20ef6502ae64"); + Opts.ApiKey = FModioApiKey("8d561adc585f3292356a20ef6502ae64"); Opts.GameEnvironment = EModioEnvironment::Test; - Opts.GameID = FModioGameID(788); + Opts.GameId = FModioGameID(788); Modio->InitializeAsync(Opts, FOnErrorOnlyDelegateFast::CreateSP(this, &FModioInitializeBadResponseAsyncCommand::Callback)); } diff --git a/Source/Modio/Private/Tests/Commands/IsModManagementBusy.h b/Source/Modio/Private/Tests/Commands/IsModManagementBusy.h index 9bcccecb..4c812c07 100644 --- a/Source/Modio/Private/Tests/Commands/IsModManagementBusy.h +++ b/Source/Modio/Private/Tests/Commands/IsModManagementBusy.h @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #pragma once #include "ModioSubsystem.h" #include "Tests/Commands/ModioTestCommandBase.h" diff --git a/Source/Modio/Private/Tests/Commands/ListAllModsAsync.h b/Source/Modio/Private/Tests/Commands/ListAllModsAsync.h index ae75beda..86e1bf06 100644 --- a/Source/Modio/Private/Tests/Commands/ListAllModsAsync.h +++ b/Source/Modio/Private/Tests/Commands/ListAllModsAsync.h @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #pragma once #include "ModioSubsystem.h" diff --git a/Source/Modio/Private/Tests/Commands/ModioTestCommandBase.cpp b/Source/Modio/Private/Tests/Commands/ModioTestCommandBase.cpp new file mode 100644 index 00000000..521cbbba --- /dev/null +++ b/Source/Modio/Private/Tests/Commands/ModioTestCommandBase.cpp @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#include "Tests/Commands/ModioTestCommandBase.h" + +#if WITH_DEV_AUTOMATION_TESTS + +ModioTestExpectedResult MakeExpected(Modio::ErrorCode RawErrorCode) +{ + ModioTestExpectedResult Expected; + Expected.Set(FModioErrorCode(RawErrorCode)); + return Expected; +} + +ModioTestExpectedResult MakeExpected(Modio::ErrorConditionTypes Condition) +{ + ModioTestExpectedResult Expected; + Expected.Set(Condition); + return Expected; +} + +bool CheckExpectedValue(FModioErrorCode ec, ModioTestExpectedResult ExpectedResult) +{ + if (ExpectedResult.IsType()) + { + return ec.GetRawErrorCode() == ExpectedResult.Get().GetRawErrorCode(); + } + else + { + return Modio::ErrorCodeMatches(ec.GetRawErrorCode(), ExpectedResult.Get()); + } +} + + FModioTestLatentCommandBase::FModioTestLatentCommandBase(FAutomationTestBase* AssociatedTest) + : CurrentTest(AssociatedTest) +{ + Modio = GEngine->GetEngineSubsystem(); +} + +bool FModioTestLatentCommandBase::Update() +{ + switch (CurrentState) + { + case LatentCommandState::NotStarted: + CurrentState = LatentCommandState::InProgress; + Start(); + return false; + break; + case LatentCommandState::InProgress: + if (Modio == nullptr) + { + return true; + } + else + { + Modio->RunPendingHandlers(); + return false; + } + break; + case LatentCommandState::Complete: + + return true; + break; + } + return true; +} + +void FModioTestLatentCommandBase::Done() +{ + CurrentState = LatentCommandState::Complete; +} + +#endif diff --git a/Source/Modio/Private/Tests/Commands/ModioTestCommandBase.h b/Source/Modio/Private/Tests/Commands/ModioTestCommandBase.h index 2371a1e9..e87eab52 100644 --- a/Source/Modio/Private/Tests/Commands/ModioTestCommandBase.h +++ b/Source/Modio/Private/Tests/Commands/ModioTestCommandBase.h @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #pragma once #include "Engine.h" @@ -10,31 +20,11 @@ using ModioTestExpectedResult = TVariant; -ModioTestExpectedResult MakeExpected(Modio::ErrorCode RawErrorCode) -{ - ModioTestExpectedResult Expected; - Expected.Set(FModioErrorCode(RawErrorCode)); - return Expected; -} +ModioTestExpectedResult MakeExpected(Modio::ErrorCode RawErrorCode); -ModioTestExpectedResult MakeExpected(Modio::ErrorConditionTypes Condition) -{ - ModioTestExpectedResult Expected; - Expected.Set(Condition); - return Expected; -} +ModioTestExpectedResult MakeExpected(Modio::ErrorConditionTypes Condition); -bool CheckExpectedValue(FModioErrorCode ec, ModioTestExpectedResult ExpectedResult) -{ - if (ExpectedResult.IsType()) - { - return ec.GetRawErrorCode() == ExpectedResult.Get().GetRawErrorCode(); - } - else - { - return Modio::ErrorCodeMatches(ec.GetRawErrorCode(), ExpectedResult.Get()); - } -} +bool CheckExpectedValue(FModioErrorCode ec, ModioTestExpectedResult ExpectedResult); class FModioTestLatentCommandBase : public IAutomationLatentCommand { @@ -50,45 +40,13 @@ class FModioTestLatentCommandBase : public IAutomationLatentCommand FAutomationTestBase* CurrentTest = nullptr; public: - FModioTestLatentCommandBase(FAutomationTestBase* AssociatedTest) : CurrentTest(AssociatedTest) - { - Modio = GEngine->GetEngineSubsystem(); - } + FModioTestLatentCommandBase(FAutomationTestBase* AssociatedTest); virtual ~FModioTestLatentCommandBase() {} - virtual bool Update() override - { - switch (CurrentState) - { - case LatentCommandState::NotStarted: - CurrentState = LatentCommandState::InProgress; - Start(); - return false; - break; - case LatentCommandState::InProgress: - if (Modio == nullptr) - { - return true; - } - else - { - Modio->RunPendingHandlers(); - return false; - } - break; - case LatentCommandState::Complete: - - return true; - break; - } - return true; - } + virtual bool Update() override; UModioSubsystem* Modio = nullptr; virtual void Start() = 0; - virtual void Done() - { - CurrentState = LatentCommandState::Complete; - } + virtual void Done(); }; class FModioTestLatentCommandBaseExpectedResult : public FModioTestLatentCommandBase diff --git a/Source/Modio/Private/Tests/Commands/QueryCurrentModUpdate.h b/Source/Modio/Private/Tests/Commands/QueryCurrentModUpdate.h index ef827f87..6abe1462 100644 --- a/Source/Modio/Private/Tests/Commands/QueryCurrentModUpdate.h +++ b/Source/Modio/Private/Tests/Commands/QueryCurrentModUpdate.h @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #pragma once #include "ModioSubsystem.h" #include "Tests/Commands/ModioTestCommandBase.h" diff --git a/Source/Modio/Private/Tests/Commands/ShutdownAsync.h b/Source/Modio/Private/Tests/Commands/ShutdownAsync.h index 3ce302d5..f8b5c988 100644 --- a/Source/Modio/Private/Tests/Commands/ShutdownAsync.h +++ b/Source/Modio/Private/Tests/Commands/ShutdownAsync.h @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #pragma once #include "ModioSubsystem.h" #include "Tests/Commands/ModioTestCommandBase.h" diff --git a/Source/Modio/Private/Tests/Commands/SubscribeToModAsync.h b/Source/Modio/Private/Tests/Commands/SubscribeToModAsync.h index c4973d4e..1f564e5f 100644 --- a/Source/Modio/Private/Tests/Commands/SubscribeToModAsync.h +++ b/Source/Modio/Private/Tests/Commands/SubscribeToModAsync.h @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #pragma once #include "ModioSubsystem.h" #include "Tests/Commands/ModioTestCommandBase.h" diff --git a/Source/Modio/Private/Tests/Commands/UnsubFromModAsync.h b/Source/Modio/Private/Tests/Commands/UnsubFromModAsync.h index f4b0a5ca..bec677e6 100644 --- a/Source/Modio/Private/Tests/Commands/UnsubFromModAsync.h +++ b/Source/Modio/Private/Tests/Commands/UnsubFromModAsync.h @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #pragma once #include "ModioSubsystem.h" #include "Tests/Commands/ModioTestCommandBase.h" diff --git a/Source/Modio/Private/Tests/GetModInfoTest.cpp b/Source/Modio/Private/Tests/GetModInfoTest.cpp index 0da8bafb..6e26f030 100644 --- a/Source/Modio/Private/Tests/GetModInfoTest.cpp +++ b/Source/Modio/Private/Tests/GetModInfoTest.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #include "Engine.h" #include "Libraries/ModioSDKLibrary.h" #include "Misc/AutomationTest.h" diff --git a/Source/Modio/Private/Tests/InitShutdownTest.cpp b/Source/Modio/Private/Tests/InitShutdownTest.cpp index c790e736..3dac958f 100644 --- a/Source/Modio/Private/Tests/InitShutdownTest.cpp +++ b/Source/Modio/Private/Tests/InitShutdownTest.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #include "Engine.h" #include "Libraries/ModioSDKLibrary.h" #include "Misc/AutomationTest.h" diff --git a/Source/Modio/Private/Tests/ListAllModsTest.cpp b/Source/Modio/Private/Tests/ListAllModsTest.cpp index e17308e9..82af6fc1 100644 --- a/Source/Modio/Private/Tests/ListAllModsTest.cpp +++ b/Source/Modio/Private/Tests/ListAllModsTest.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #include "Engine.h" #include "Libraries/ModioSDKLibrary.h" #include "Misc/AutomationTest.h" diff --git a/Source/Modio/Private/Tests/ModManagementTest.cpp b/Source/Modio/Private/Tests/ModManagementTest.cpp index 3afc6f19..f80e0dc7 100644 --- a/Source/Modio/Private/Tests/ModManagementTest.cpp +++ b/Source/Modio/Private/Tests/ModManagementTest.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #include "Engine.h" #include "Libraries/ModioSDKLibrary.h" #include "Misc/AutomationTest.h" diff --git a/Source/Modio/Private/Tests/ModioTestValidationData.cpp b/Source/Modio/Private/Tests/ModioTestValidationData.cpp index 55e96020..65490848 100644 --- a/Source/Modio/Private/Tests/ModioTestValidationData.cpp +++ b/Source/Modio/Private/Tests/ModioTestValidationData.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + // Fill out your copyright notice in the Description page of Project Settings. #include "Tests/ModioTestValidationData.h" diff --git a/Source/Modio/Private/Tests/ModioTestValidationData.h b/Source/Modio/Private/Tests/ModioTestValidationData.h index 3a217c39..c4f5bc37 100644 --- a/Source/Modio/Private/Tests/ModioTestValidationData.h +++ b/Source/Modio/Private/Tests/ModioTestValidationData.h @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + // Fill out your copyright notice in the Description page of Project Settings. #pragma once diff --git a/Source/Modio/Private/Tests/SubscriptionTest.cpp b/Source/Modio/Private/Tests/SubscriptionTest.cpp index 548e7976..5c2aaa53 100644 --- a/Source/Modio/Private/Tests/SubscriptionTest.cpp +++ b/Source/Modio/Private/Tests/SubscriptionTest.cpp @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #include "Engine.h" #include "Libraries/ModioSDKLibrary.h" #include "Misc/AutomationTest.h" diff --git a/Source/Modio/Private/Tests/ToModio.cpp b/Source/Modio/Private/Tests/ToModio.cpp index b394f670..2d153ba5 100644 --- a/Source/Modio/Private/Tests/ToModio.cpp +++ b/Source/Modio/Private/Tests/ToModio.cpp @@ -1,6 +1,18 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #include "Engine.h" +#include "Internal/Convert/AuthParams.h" #include "Libraries/ModioSDKLibrary.h" #include "Misc/AutomationTest.h" +#include "ModioSDK.h" #include "Types/ModioAuthenticationParams.h" #include "Types/ModioModStats.h" @@ -27,6 +39,4 @@ bool FModioConvertDataToNativeFormatTest::RunTest(const FString& Parameters) return true; } - - #endif // WITH_DEV_AUTOMATION_TESTS \ No newline at end of file diff --git a/Source/Modio/Private/Tests/ToUnreal.cpp b/Source/Modio/Private/Tests/ToUnreal.cpp index 571847f5..54bf2dd4 100644 --- a/Source/Modio/Private/Tests/ToUnreal.cpp +++ b/Source/Modio/Private/Tests/ToUnreal.cpp @@ -1,9 +1,20 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #include "Engine.h" #include "Libraries/ModioSDKLibrary.h" #include "Misc/AutomationTest.h" #include "Tests/Commands/InitializeAsync.h" #include "Tests/Commands/ShutdownAsync.h" #include "Tests/Commands/SubscribeToModAsync.h" +#include "Internal/Convert/ModStats.h" #if WITH_DEV_AUTOMATION_TESTS diff --git a/Source/Modio/Private/Types/ModioAuthenticationParams.cpp b/Source/Modio/Private/Types/ModioAuthenticationParams.cpp deleted file mode 100644 index d1cf85e2..00000000 --- a/Source/Modio/Private/Types/ModioAuthenticationParams.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "Types/ModioAuthenticationParams.h" -#include "Internal/ModioConvert.h" -#include "GenericPlatform/GenericPlatformHttp.h" - -FModioAuthenticationParams::operator Modio::AuthenticationParams() const -{ - Modio::AuthenticationParams Params; - Params.AuthToken = ToSTD(FGenericPlatformHttp::UrlEncode(AuthToken)); - Params.UserEmail = UserEmail.TrimStartAndEnd().IsEmpty() ? Modio::Optional(ToSTD(UserEmail)) : Modio::Optional(); - Params.bUserHasAcceptedTerms = bUserHasAcceptedTerms; - - return Params; -} diff --git a/Source/Modio/Private/Types/ModioCommonTypes.cpp b/Source/Modio/Private/Types/ModioCommonTypes.cpp index b56adbb1..08745ab8 100644 --- a/Source/Modio/Private/Types/ModioCommonTypes.cpp +++ b/Source/Modio/Private/Types/ModioCommonTypes.cpp @@ -1,15 +1,57 @@ -#include "Types/ModioCommonTypes.h" +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#include "Types/ModioCommonTypes.h" +#include "ModioSDK.h" + +#include "Internal/ModioConvert.h" FModioModID::FModioModID() : ModID(INDEX_NONE) {} +uint32 GetTypeHash(FModioModID ModioModId) +{ + return FCrc::MemCrc32(&ModioModId.ModID, sizeof(Modio::ModID)); +} + FModioGameID::FModioGameID() : GameID(INDEX_NONE) {} +FModioGameID FModioGameID::InvalidGameID() +{ + return FModioGameID(Modio::GameID::InvalidGameID()); +} + +uint32 GetTypeHash(FModioGameID ModioGameId) +{ + return FCrc::MemCrc32(&ModioGameId.GameID, sizeof(Modio::GameID)); +} + FModioFileMetadataID::FModioFileMetadataID() : FileMetadataID(INDEX_NONE) {} +uint32 GetTypeHash(FModioFileMetadataID FileMetadataID) +{ + return FCrc::MemCrc32(&FileMetadataID.FileMetadataID, sizeof(Modio::FileMetadataID)); +} + FModioUserID::FModioUserID() : UserID(INDEX_NONE) {} +uint32 GetTypeHash(FModioUserID UserID) +{ + return FCrc::MemCrc32(&UserID.UserID, sizeof(Modio::UserID)); +} + FModioApiKey::FModioApiKey(const FString& InApiKey) : ApiKey(TCHAR_TO_UTF8(*InApiKey)) {} -FModioApiKey::FModioApiKey(const Modio::ApiKey& InApiKey) : ApiKey(TCHAR_TO_UTF8((*InApiKey).c_str())) {} + +FModioApiKey FModioApiKey::InvalidAPIKey() +{ + return FModioApiKey(ToUnreal(*Modio::ApiKey::InvalidAPIKey())); +} FModioEmailAddress::FModioEmailAddress(const FString& InEmailAddress) : EmailAddress(InEmailAddress.TrimStartAndEnd()) {} diff --git a/Source/Modio/Private/Types/ModioErrorCode.cpp b/Source/Modio/Private/Types/ModioErrorCode.cpp index 860a167a..13c468b6 100644 --- a/Source/Modio/Private/Types/ModioErrorCode.cpp +++ b/Source/Modio/Private/Types/ModioErrorCode.cpp @@ -1,9 +1,66 @@ -#include "Types/ModioErrorCode.h" -#include +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ -FModioErrorCode::FModioErrorCode(Modio::ErrorCode ec) : Error(ec) {} +#include "Types/ModioErrorCode.h" +#include "ModioSDK.h" + +FModioErrorCode::FModioErrorCode(Modio::ErrorCode ec) +{ + Error = MakeUnique(ec); +} + + FModioErrorCode::FModioErrorCode() + { + Error = MakeUnique(); + } + + FModioErrorCode::FModioErrorCode(const FModioErrorCode& Other) + { + Error = MakeUnique(Other.GetRawErrorCode()); + } + + FModioErrorCode& FModioErrorCode::operator=(const FModioErrorCode& ec) +{ + Error = MakeUnique(ec.GetRawErrorCode()); + return *this; +} + + FModioErrorCode::~FModioErrorCode() + { + Error.Reset(); + } + +FModioErrorCode::operator bool() const +{ + return Error->value() != 0; +} + +int FModioErrorCode::GetValue() const +{ + return Error->value(); +} + +Modio::ErrorCode FModioErrorCode::GetRawErrorCode() const +{ + return *Error; +} FString FModioErrorCode::GetMessage() const { - return FString(UTF8_TO_TCHAR(Error.message().c_str())); + if (*Error) + { + return FString(UTF8_TO_TCHAR(Error->message().c_str())); + } + else + { + return FString(); + } } + diff --git a/Source/Modio/Private/Types/ModioFilterParamsUImpl.cpp b/Source/Modio/Private/Types/ModioFilterParamsUImpl.cpp new file mode 100644 index 00000000..b1dd23ff --- /dev/null +++ b/Source/Modio/Private/Types/ModioFilterParamsUImpl.cpp @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#include "Types/ModioFilterParams.h" +#include "Internal/Convert/FilterParams.h" + +FModioFilterParams& FModioFilterParams::MatchingIDs(const TArray& IDs) +{ + IncludedIDs = IDs; + return *this; +} + +FModioFilterParams& FModioFilterParams::ExcludingIDs(const TArray& IDs) +{ + ExcludedIDs = IDs; + return *this; +} + +FModioFilterParams& FModioFilterParams::SortBy(EModioSortFieldType ByField, EModioSortDirection ByDirection) +{ + SortField = ByField; + Direction = ByDirection; + return *this; +} + +FModioFilterParams& FModioFilterParams::NameContains(const FString& SearchString) +{ + SearchKeywords.Empty(); + SearchKeywords.Add(SearchString); + return *this; +} + +FModioFilterParams& FModioFilterParams::NameContains(const TArray& SearchString) +{ + SearchKeywords = SearchString; + return *this; +} + +FModioFilterParams& FModioFilterParams::MarkedLiveAfter(FDateTime LiveAfter) +{ + DateRangeBegin = LiveAfter; + return *this; +} + +FModioFilterParams& FModioFilterParams::MarkedLiveBefore(FDateTime LiveBefore) +{ + DateRangeEnd = LiveBefore; + return *this; +} + +FModioFilterParams& FModioFilterParams::WithTags(const FString& Tag) +{ + Tags.Empty(); + Tags.Add(Tag); + return *this; +} + +FModioFilterParams& FModioFilterParams::WithTags(const TArray& NewTags) +{ + Tags = NewTags; + return *this; +} + +FModioFilterParams& FModioFilterParams::WithoutTags(const FString& Tag) +{ + ExcludedTags.Empty(); + ExcludedTags.Add(Tag); + return *this; +} + +FModioFilterParams& FModioFilterParams::WithoutTags(const TArray& NewTags) +{ + ExcludedTags = NewTags; + return *this; +} + +FModioFilterParams& FModioFilterParams::IndexedResults(uint64 StartIndex, uint64 ResultCount) +{ + isPaged = false; + Index = StartIndex; + Count = ResultCount; + return *this; +} + +FModioFilterParams& FModioFilterParams::PagedResults(uint64 PageNumber, uint64 PageSize) +{ + isPaged = true; + Index = PageNumber; + Count = PageSize; + return *this; +} + +FString FModioFilterParams::ToString() const +{ + return FString(UTF8_TO_TCHAR(ToModio(*this).ToString().c_str())); +} \ No newline at end of file diff --git a/Source/Modio/Private/Types/ModioImage.cpp b/Source/Modio/Private/Types/ModioImage.cpp index 59fce529..0655ba24 100644 --- a/Source/Modio/Private/Types/ModioImage.cpp +++ b/Source/Modio/Private/Types/ModioImage.cpp @@ -1,4 +1,14 @@ -#include "Types/ModioImage.h" +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#include "Types/ModioImage.h" #include "Async/Async.h" #include "Engine/Engine.h" @@ -13,7 +23,6 @@ #include "Modules/ModuleManager.h" #include "RenderingThread.h" -FModioImage::FModioImage(const Modio::filesystem::path& Path) : ImagePath(ToUnreal(Path)) {} #if !UE_SERVER static TOptional> GetImageData(TSharedPtr ImageWrapper, ERGBFormat InFormat); diff --git a/Source/Modio/Private/Types/ModioMetadata.cpp b/Source/Modio/Private/Types/ModioMetadata.cpp deleted file mode 100644 index 7bbde29e..00000000 --- a/Source/Modio/Private/Types/ModioMetadata.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "Types/ModioMetadata.h" -#include "ModioSDK.h" -#include "Internal/ModioConvert.h" -FModioMetadata::FModioMetadata(const Modio::Metadata& Metadata) - : Key(ToUnreal(Metadata.Key)), - Value(ToUnreal(Metadata.Value)) -{} diff --git a/Source/Modio/Private/Types/ModioModCollectionEntryUImpl.cpp b/Source/Modio/Private/Types/ModioModCollectionEntryUImpl.cpp new file mode 100644 index 00000000..dd345f20 --- /dev/null +++ b/Source/Modio/Private/Types/ModioModCollectionEntryUImpl.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#include "Types/ModioModCollectionEntry.h" +#include "Internal/ModioConvert.h" + +EModioModState FModioModCollectionEntry::GetModState() const +{ + return ModState; +} + +FModioModID FModioModCollectionEntry::GetID() const +{ + return ModID; +} + +const FModioModInfo& FModioModCollectionEntry::GetModProfile() const +{ + return ModProfile; +} + +const FString FModioModCollectionEntry::GetPath() const +{ + if (ModPath) + { + return ModPath.GetValue(); + } + else + { + return {}; + } +} diff --git a/Source/Modio/Private/Types/ModioModInfoList.cpp b/Source/Modio/Private/Types/ModioModInfoList.cpp index 3938195c..9ea87854 100644 --- a/Source/Modio/Private/Types/ModioModInfoList.cpp +++ b/Source/Modio/Private/Types/ModioModInfoList.cpp @@ -1,4 +1,16 @@ -#include "Types/ModioModInfoList.h" +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#include "Types/ModioModInfoList.h" +#include "Internal/Convert/ModInfo.h" +#include "ModioSDK.h" FModioModInfoList::FModioModInfoList(const Modio::ModInfoList& ModInfoList) : FModioPagedResult(ModInfoList), diff --git a/Source/Modio/Private/Types/ModioModManagementEvent.cpp b/Source/Modio/Private/Types/ModioModManagementEvent.cpp deleted file mode 100644 index 8757af63..00000000 --- a/Source/Modio/Private/Types/ModioModManagementEvent.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "Types/ModioModManagementEvent.h" -#include "Internal/ModioConvert.h" - -FModioModManagementEvent::FModioModManagementEvent(const Modio::ModManagementEvent& Event) - : ID(ToUnreal(Event.ID)), - Event(ToUnreal(Event.Event)), - Status(ToUnreal(Event.Status)) -{} diff --git a/Source/Modio/Private/Types/ModioModProgressInfo.cpp b/Source/Modio/Private/Types/ModioModProgressInfo.cpp deleted file mode 100644 index 22008423..00000000 --- a/Source/Modio/Private/Types/ModioModProgressInfo.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "Types/ModioModProgressInfo.h" -#include "Internal/ModioConvert.h" -#include "ModioSDK.h" - -FModioModProgressInfo::FModioModProgressInfo(const Modio::ModProgressInfo& ModProgressInfo) - : TotalDownloadSize(ToUnreal(ModProgressInfo.TotalDownloadSize)), - CurrentlyDownloadedBytes(ToUnreal(ModProgressInfo.CurrentlyDownloadedBytes)), - TotalExtractedSizeOnDisk(ToUnreal(ModProgressInfo.TotalExtractedSizeOnDisk)), - CurrentlyExtractedBytes(ToUnreal(ModProgressInfo.CurrentlyExtractedBytes)), - ID(ToUnreal(ModProgressInfo.ID)) -{} diff --git a/Source/Modio/Private/Types/ModioModTag.cpp b/Source/Modio/Private/Types/ModioModTag.cpp deleted file mode 100644 index 0ffd1066..00000000 --- a/Source/Modio/Private/Types/ModioModTag.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "Types/ModioModTag.h" -#include "Internal/ModioConvert.h" -FModioModTag::FModioModTag(const Modio::ModTag& ModTag) : Tag(ToUnreal(ModTag.Tag)) {} diff --git a/Source/Modio/Private/Types/ModioModTagInfo.cpp b/Source/Modio/Private/Types/ModioModTagInfo.cpp deleted file mode 100644 index ff13a1b7..00000000 --- a/Source/Modio/Private/Types/ModioModTagInfo.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "Types/ModioModTagInfo.h" -#include "Internal/ModioConvert.h" - -FModioModTagInfo::FModioModTagInfo(const Modio::ModTagInfo& ModTagInfo) - : TagGroupName(ToUnreal(ModTagInfo.TagGroupName)), - TagGroupValues(ToUnreal(ModTagInfo.TagGroupValues)), - bAllowMultipleSelection(ToUnreal(ModTagInfo.bAllowMultipleSelection)) - -{} diff --git a/Source/Modio/Private/Types/ModioModTagOptions.cpp b/Source/Modio/Private/Types/ModioModTagOptions.cpp index 6f947551..c7955b39 100644 --- a/Source/Modio/Private/Types/ModioModTagOptions.cpp +++ b/Source/Modio/Private/Types/ModioModTagOptions.cpp @@ -1,4 +1,16 @@ -#include "Types/ModioModTagOptions.h" +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#include "Types/ModioModTagOptions.h" +#include "Internal/Convert/ModTagInfo.h" +#include "ModioSDK.h" FModioModTagOptions::FModioModTagOptions(const Modio::ModTagOptions& ModInfoList) : FModioPagedResult(ModInfoList), diff --git a/Source/Modio/Private/Types/ModioSDKPagedResult.cpp b/Source/Modio/Private/Types/ModioPagedResultUImpl.cpp similarity index 65% rename from Source/Modio/Private/Types/ModioSDKPagedResult.cpp rename to Source/Modio/Private/Types/ModioPagedResultUImpl.cpp index 01d3ebdc..e6b6076c 100644 --- a/Source/Modio/Private/Types/ModioSDKPagedResult.cpp +++ b/Source/Modio/Private/Types/ModioPagedResultUImpl.cpp @@ -1,4 +1,15 @@ -#include "Types/ModioPagedResult.h" +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#include "Types/ModioPagedResult.h" +#include "ModioSDK.h" FModioPagedResult::FModioPagedResult(const Modio::PagedResult& PagedResult) : PageIndex(PagedResult.GetPageIndex()), diff --git a/Source/Modio/Private/Types/ModioReportParamsUImpl.cpp b/Source/Modio/Private/Types/ModioReportParamsUImpl.cpp new file mode 100644 index 00000000..f10a0b3a --- /dev/null +++ b/Source/Modio/Private/Types/ModioReportParamsUImpl.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#include "ModioSDK.h" +#include "Internal/ModioConvert.h" +#include "Types/ModioCommonTypes.h" +#include "Types/ModioReportParams.h" + +FModioReportParams::FModioReportParams(FModioGameID Game, EModioReportType Type, FString ReportDescription, + TOptional ReporterName, TOptional ReporterContact) + : FModioReportParams(ToModio(Game), FModioReportParams::ResourceType::Game, Type, ReportDescription, ReporterName, + ReporterContact) +{} + +FModioReportParams::FModioReportParams(FModioUserID User, EModioReportType Type, FString ReportDescription, + TOptional ReporterName, TOptional ReporterContact) + : FModioReportParams(ToModio(User), FModioReportParams::ResourceType::User, Type, ReportDescription, ReporterName, + ReporterContact) +{} + +FModioReportParams::FModioReportParams(FModioModID Mod, EModioReportType Type, FString ReportDescription, + TOptional ReporterName, + TOptional ReporterContact) + : FModioReportParams(ToModio(Mod), FModioReportParams::ResourceType::Mod, Type, ReportDescription, ReporterName, + ReporterContact) +{} + +FModioReportParams::FModioReportParams(int64 ResourceID, ResourceType ReportedResourceType, EModioReportType Type, + FString ReportDescription, + TOptional ReporterName, TOptional ReporterContact) + : ReportedResourceType(ReportedResourceType), + ResourceID(ResourceID), + Type(Type), + ReporterName(ReporterName), + ReporterContact(ReporterContact), + ReportDescription(ReportDescription) +{} + +FModioReportParams::FModioReportParams() + : ReportedResourceType(FModioReportParams::ResourceType::Game), + ResourceID(ToModio(FModioGameID::InvalidGameID())), + Type(EModioReportType::Other), + ReporterName(), + ReporterContact(), + ReportDescription("") +{} \ No newline at end of file diff --git a/Source/Modio/Private/Types/ModioSDKFileMetadata.cpp b/Source/Modio/Private/Types/ModioSDKFileMetadata.cpp deleted file mode 100644 index f78197d3..00000000 --- a/Source/Modio/Private/Types/ModioSDKFileMetadata.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include "Types/ModioFileMetadata.h" -#include "Internal/ModioConvert.h" - -FModioFileMetadata::FModioFileMetadata(const Modio::FileMetadata& ModInfo) - : MetadataId(ToUnreal(ModInfo.MetadataId)), - ModId(ToUnreal(ModInfo.ModId)), - DateAdded(ToUnrealDateTime(ModInfo.DateAdded)), - CurrentVirusScanStatus(ToUnreal(ModInfo.CurrentVirusScanStatus)), - CurrentVirusStatus(ToUnreal(ModInfo.CurrentVirusStatus)), - Filesize(ToUnreal(ModInfo.Filesize)), - Filename(ToUnreal(ModInfo.Filename)), - Version(ToUnreal(ModInfo.Version)), - Changelog(ToUnreal(ModInfo.Changelog)), - MetadataBlob(FString(ModInfo.MetadataBlob.c_str())) -{} diff --git a/Source/Modio/Private/Types/ModioSDKModCollectionEntry.cpp b/Source/Modio/Private/Types/ModioSDKModCollectionEntry.cpp deleted file mode 100644 index 55275ced..00000000 --- a/Source/Modio/Private/Types/ModioSDKModCollectionEntry.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include "Types/ModioModCollectionEntry.h" -#include "Internal/ModioConvert.h" - -FModioModCollectionEntry::FModioModCollectionEntry(Modio::ModCollectionEntry&& ModCollectionEntry) - : ModCollectionEntry(MoveTemp(ModCollectionEntry)) -{} - -EModioModState FModioModCollectionEntry::GetModState() const -{ - return ToUnreal(ModCollectionEntry.GetModState()); -} - -FModioModID FModioModCollectionEntry::GetID() const -{ - return ToUnreal(ModCollectionEntry.GetID()); -} - -const FModioModInfo& FModioModCollectionEntry::GetModProfile() const -{ - if (!CachedModInfo) - { - CachedModInfo = ToUnreal(ModCollectionEntry.GetModProfile()); - } - return CachedModInfo.GetValue(); -} - -const FString& FModioModCollectionEntry::GetPath() const -{ - if (!CachedPath) - { - CachedPath = ToUnreal(ModCollectionEntry.GetPath().string()); - } - return CachedPath.GetValue(); -} diff --git a/Source/Modio/Private/Types/ModioSDKModInfo.cpp b/Source/Modio/Private/Types/ModioSDKModInfo.cpp deleted file mode 100644 index df6297c9..00000000 --- a/Source/Modio/Private/Types/ModioSDKModInfo.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "Types/ModioModInfo.h" -#include "Internal/ModioConvert.h" - -FModioModInfo::FModioModInfo(const Modio::ModInfo& ModInfo) - : ModId(ToUnreal(ModInfo.ModId)), - ProfileName(ToUnreal(ModInfo.ProfileName)), - ProfileSummary(ToUnreal(ModInfo.ProfileSummary)), - ProfileDescription(ToUnreal(ModInfo.ProfileDescription)), - ProfileDescriptionPlaintext(ToUnreal(ModInfo.ProfileDescriptionPlaintext)), - ProfileURL(ToUnreal(ModInfo.ProfileURL)), - ProfileSubmittedBy(ToUnreal(ModInfo.ProfileSubmittedBy)), - ProfileDateAdded(ToUnrealDateTime(ModInfo.ProfileDateAdded)), - ProfileDateUpdated(ToUnrealDateTime(ModInfo.ProfileDateUpdated)), - ProfileDateLive(ToUnrealDateTime(ModInfo.ProfileDateLive)), - ProfileMaturityOption(ToUnreal(ModInfo.ProfileMaturityOption)), - MetadataBlob(ModInfo.MetadataBlob.c_str()), // Don't use ToUnreal as that does UTF8->TCHAR conversion - FileInfo(ToUnreal(ModInfo.FileInfo)), - MetadataKvp(ToUnreal(ModInfo.MetadataKvp)), - Tags(ToUnreal(ModInfo.Tags)), - NumGalleryImages(ToUnreal(ModInfo.NumGalleryImages)), - YoutubeURLs(ToUnreal(ModInfo.YoutubeURLs)), - SketchfabURLs(ToUnreal(ModInfo.SketchfabURLs)), - Stats(ToUnreal(ModInfo.Stats)) -{} diff --git a/Source/Modio/Private/Types/ModioSDKModStats.cpp b/Source/Modio/Private/Types/ModioSDKModStats.cpp deleted file mode 100644 index 851f1a68..00000000 --- a/Source/Modio/Private/Types/ModioSDKModStats.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "Types/ModioModStats.h" -#include "ModioSDK.h" -#include "Internal/ModioConvert.h" - -FModioModStats::FModioModStats(const Modio::ModStats& Stats) - : PopularityRankPosition(ToUnreal(Stats.PopularityRankPosition)), - PopularityRankTotalMods(ToUnreal(Stats.PopularityRankTotalMods)), - DownloadsTotal(ToUnreal(Stats.DownloadsTotal)), - SubscribersTotal(ToUnreal(Stats.SubscribersTotal)), - RatingTotal(ToUnreal(Stats.RatingTotal)), - RatingPositive(ToUnreal(Stats.RatingPositive)), - RatingNegative(ToUnreal(Stats.RatingNegative)), - RatingPercentagePositive(ToUnreal(Stats.RatingPercentagePositive)), - RatingWeightedAggregate(ToUnreal(Stats.RatingWeightedAggregate)), - RatingDisplayText(ToUnreal(Stats.RatingDisplayText)) -{} diff --git a/Source/Modio/Private/Types/ModioSDKURLList.cpp b/Source/Modio/Private/Types/ModioSDKURLList.cpp deleted file mode 100644 index 282edaa4..00000000 --- a/Source/Modio/Private/Types/ModioSDKURLList.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "Types/ModioURLList.h" -#include "Internal/ModioConvert.h" - -FModioYoutubeURLList::FModioYoutubeURLList(const Modio::YoutubeURLList& URLList) - : FModioList(ToUnrealList(URLList)) -{} - -FModioSketchfabURLList::FModioSketchfabURLList(const Modio::SketchfabURLList& URLList) - : FModioList(ToUnrealList(URLList)) -{} diff --git a/Source/Modio/Private/Types/ModioTerms.cpp b/Source/Modio/Private/Types/ModioTerms.cpp deleted file mode 100644 index 9179aa48..00000000 --- a/Source/Modio/Private/Types/ModioTerms.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "Types/ModioTerms.h" - -#include "ModioSDK.h" -#include "Internal/ModioConvert.h" - -FModioLink::FModioLink(const Modio::Terms::Link& Link) : - Text(ToUnreal(Link.Text)), - URL(ToUnreal(Link.URL)), - bRequired(ToUnreal(Link.bRequired)) -{ -} - -FModioTerms::FModioTerms(const Modio::Terms& Terms) : - AgreeButtonText(ToUnreal(Terms.Buttons.AgreeText)), - DisagreeButtonText(ToUnreal(Terms.Buttons.DisagreeText)), - WebsiteLink(ToUnreal(Terms.Links.Website)), - TermsLink(ToUnreal(Terms.Links.Terms)), - PrivacyLink(ToUnreal(Terms.Links.Privacy)), - ManageLink(ToUnreal(Terms.Links.Manage)), - TermsText(ToUnreal(Terms.TermsText)) -{ -} - -FModioOptionalTerms::FModioOptionalTerms(TOptional&& ModTagOptions) : - Internal(MoveTemp(ModTagOptions)) -{ -} \ No newline at end of file diff --git a/Source/Modio/Private/Types/ModioURLListUImpl.cpp b/Source/Modio/Private/Types/ModioURLListUImpl.cpp new file mode 100644 index 00000000..6b421127 --- /dev/null +++ b/Source/Modio/Private/Types/ModioURLListUImpl.cpp @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#include "Types/ModioURLList.h" +#include "ModioSDK.h" +#include "Internal/ModioConvert.h" + +FModioYoutubeURLList::FModioYoutubeURLList(const Modio::YoutubeURLList& URLList) + : FModioList(ToUnrealList(URLList)) +{} + +FModioSketchfabURLList::FModioSketchfabURLList(const Modio::SketchfabURLList& URLList) + : FModioList(ToUnrealList(URLList)) +{} diff --git a/Source/Modio/Private/Types/ModioUser.cpp b/Source/Modio/Private/Types/ModioUser.cpp deleted file mode 100644 index 860f4625..00000000 --- a/Source/Modio/Private/Types/ModioUser.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "Types/ModioUser.h" -#include "Internal/ModioConvert.h" - -FModioUser::FModioUser(const Modio::User& User) - : UserId(ToUnreal(User.UserId)), - Username(ToUnreal(User.Username)), - DateOnline(ToUnreal(User.DateOnline)), - ProfileUrl(ToUnreal(User.ProfileUrl)) -{} - -FModioOptionalUser::FModioOptionalUser(TOptional&& ModInfoList) : Internal(ModInfoList) {} diff --git a/Source/Modio/Private/UI/ModioExampleLibrary.cpp b/Source/Modio/Private/UI/ModioExampleLibrary.cpp index 29adf6ba..0ce4d151 100644 --- a/Source/Modio/Private/UI/ModioExampleLibrary.cpp +++ b/Source/Modio/Private/UI/ModioExampleLibrary.cpp @@ -1,4 +1,14 @@ -#include "UI/ModioExampleLibrary.h" +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#include "UI/ModioExampleLibrary.h" #include "ModioSubsystem.h" #include "Async/Async.h" #include "Engine/Engine.h" diff --git a/Source/Modio/Private/UI/ModioPopupContainer.cpp b/Source/Modio/Private/UI/ModioPopupContainer.cpp index 23db28a8..baf8f3e8 100644 --- a/Source/Modio/Private/UI/ModioPopupContainer.cpp +++ b/Source/Modio/Private/UI/ModioPopupContainer.cpp @@ -1,4 +1,14 @@ -#include "UI/ModioPopupContainer.h" +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#include "UI/ModioPopupContainer.h" #include "UI/ModioPopupBase.h" UModioPopupContainer::UModioPopupContainer(const FObjectInitializer& ObjectInitializer) : diff --git a/Source/Modio/Public/Internal/ModioConvert.h b/Source/Modio/Public/Internal/ModioConvert.h deleted file mode 100644 index e8dd8e44..00000000 --- a/Source/Modio/Public/Internal/ModioConvert.h +++ /dev/null @@ -1,129 +0,0 @@ -#pragma once - -#include -#include -#include - -#include "Containers/StringConv.h" -#include "Containers/UnrealString.h" -#include "Misc/DateTime.h" -#include "ModioSDK.h" - -FORCEINLINE std::string ToSTD(const FString& String); -FORCEINLINE std::vector ToSTD(const TArray& StringArray); -FORCEINLINE std::chrono::system_clock::time_point ToSTD(FDateTime Time); - -// @todo: Make a ToModio that handles TOptional through templates - -FORCEINLINE int64 ToUnreal(std::int64_t Value); -FORCEINLINE uint8 ToUnreal(std::uint8_t Value); -FORCEINLINE double ToUnreal(double Value); -FORCEINLINE bool ToUnreal(bool Value); -FORCEINLINE uint64 ToUnreal(std::size_t Value); -FORCEINLINE FString ToUnreal(const std::string& String); -FORCEINLINE FString ToUnreal(const Modio::filesystem::path& Path); -FORCEINLINE FDateTime ToUnrealDateTime(std::int64_t UnixTimestamp); - -template -FORCEINLINE TArray ToUnreal(std::vector&& OriginalArray); - -template -FORCEINLINE TArray ToUnreal(const std::vector& OriginalArray); - -#pragma region Implementation - -// @todo: Rename this to ToModio as it doesn't matter that it's the part of STD of modio -std::string ToSTD(const FString& String) -{ - return std::string(TCHAR_TO_UTF8(*String)); -} - -// @todo: Rename this to ToModio as it doesn't matter that it's the part of STD of modio -std::vector ToSTD(const TArray& StringArray) -{ - std::vector Result; - Result.reserve(StringArray.Num()); - for (const FString& It : StringArray) - { - Result.emplace_back(TCHAR_TO_UTF8(*It)); - } - return Result; -} - -// @todo: Rename this to ToModio as it doesn't matter that it's the part of STD of modio -std::chrono::system_clock::time_point ToSTD(FDateTime Time) -{ - // @todonow: Verify that this becomes correct by printf debugging - return std::chrono::system_clock::time_point(std::chrono::system_clock::duration(Time.ToUnixTimestamp())); -} - -int64 ToUnreal(std::int64_t Value) -{ - return Value; -} - -bool ToUnreal(bool Value) -{ - return Value; -} - -uint8 ToUnreal(std::uint8_t Value) -{ - return Value; -} - -double ToUnreal(double Value) -{ - return Value; -} - -uint64 ToUnreal(std::size_t Value) -{ - static_assert(sizeof(std::size_t) == sizeof(uint64), "size_t is not 64-bits wide. Are you in x64 configuration?"); - return Value; -} - -FString ToUnreal(const std::string& String) -{ - return UTF8_TO_TCHAR(String.c_str()); -} - -FString ToUnreal(const Modio::filesystem::path& Path) -{ - return UTF8_TO_TCHAR(Path.generic_u8string().c_str()); -} - -FDateTime FORCEINLINE ToUnrealDateTime(std::int64_t UnixTimestamp) -{ - return FDateTime::FromUnixTimestamp(UnixTimestamp); -} - -template -TArray ToUnreal(std::vector&& OriginalArray) -{ - TArray Result; - - Result.Reserve(OriginalArray.size()); - for (auto& It : OriginalArray) - { - Result.Emplace(ToUnreal(MoveTemp(It))); - } - - return Result; -} - -template -TArray ToUnreal(const std::vector& OriginalArray) -{ - TArray Result; - - Result.Reserve(OriginalArray.size()); - for (const auto& It : OriginalArray) - { - Result.Emplace(ToUnreal(It)); - } - - return Result; -} - -#pragma endregion diff --git a/Source/Modio/Public/Internal/ModioPrivateDefines.h b/Source/Modio/Public/Internal/ModioPrivateDefines.h deleted file mode 100644 index a63568b6..00000000 --- a/Source/Modio/Public/Internal/ModioPrivateDefines.h +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -// This makes missing a value in the switch statement a fatal error, is disabled after our conversion routines -#define MODIO_BEGIN_CONVERT_SWITCHES \ - __pragma(warning(push)) \ - __pragma(warning(error : 4062)) - -#define MODIO_END_CONVERT_SWITCHES \ - __pragma(warning(pop)) diff --git a/Source/Modio/Public/Libraries/ModioCommonTypesLibrary.h b/Source/Modio/Public/Libraries/ModioCommonTypesLibrary.h index 7d1c0ad9..d67ab985 100644 --- a/Source/Modio/Public/Libraries/ModioCommonTypesLibrary.h +++ b/Source/Modio/Public/Libraries/ModioCommonTypesLibrary.h @@ -1,8 +1,19 @@ -#pragma once +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once #include "Kismet/BlueprintFunctionLibrary.h" #include "Types/ModioCommonTypes.h" #include "Types/ModioInitializeOptions.h" +#include "Types/ModioAuthenticationParams.h" // clang-format off #include "ModioCommonTypesLibrary.generated.h" @@ -38,7 +49,7 @@ class UModioCommonTypesLibrary : public UBlueprintFunctionLibrary * @return The constructed FModioAuthenticationParams object for use with <> */ UFUNCTION(BlueprintPure, category = "mod.io|Utilities", meta = (NativeMakeFunc)) - static struct FModioAuthenticationParams MakeAuthParams(const FString AuthToken, const FString EmailAddress, const bool bHasAcceptedTOS); + static FModioAuthenticationParams MakeAuthParams(const FString AuthToken, const FString EmailAddress, const bool bHasAcceptedTOS); /** * @brief Create a ApiKey id from a string, should only be used in conjunction with InitializeAsync diff --git a/Source/Modio/Public/Libraries/ModioErrorCodeLibrary.h b/Source/Modio/Public/Libraries/ModioErrorCodeLibrary.h index be132170..d4119c56 100644 --- a/Source/Modio/Public/Libraries/ModioErrorCodeLibrary.h +++ b/Source/Modio/Public/Libraries/ModioErrorCodeLibrary.h @@ -1,4 +1,14 @@ -#pragma once +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once #include "Kismet/BlueprintFunctionLibrary.h" #include "Types/ModioErrorCode.h" diff --git a/Source/Modio/Public/Libraries/ModioErrorConditionLibrary.h b/Source/Modio/Public/Libraries/ModioErrorConditionLibrary.h new file mode 100644 index 00000000..4610f8c5 --- /dev/null +++ b/Source/Modio/Public/Libraries/ModioErrorConditionLibrary.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once +#include "Kismet/BlueprintFunctionLibrary.h" +#include "Types/ModioErrorCode.h" +#include "ModioErrorCondition.h" + +#include "ModioErrorConditionLibrary.generated.h" + + +UCLASS() +class UModioErrorConditionLibrary : public UBlueprintFunctionLibrary +{ + GENERATED_BODY() + +public: + /** + * @brief Checks if the passed-in ErrorCode matches the specified error condition + * @param ErrorCode The code to check + * @param Condition The error condition to check against + * @return true if the code matches the condition + */ + UFUNCTION(BlueprintCallable, Category = "mod.io|Error Handling") + static bool ErrorCodeMatches(FModioErrorCode ErrorCode, EModioErrorCondition Condition); +}; \ No newline at end of file diff --git a/Source/Modio/Public/Libraries/ModioFilterParamsLibrary.h b/Source/Modio/Public/Libraries/ModioFilterParamsLibrary.h index 696d4aa1..4bc767bc 100644 --- a/Source/Modio/Public/Libraries/ModioFilterParamsLibrary.h +++ b/Source/Modio/Public/Libraries/ModioFilterParamsLibrary.h @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #pragma once #include "Kismet/BlueprintFunctionLibrary.h" diff --git a/Source/Modio/Public/Libraries/ModioImageLibrary.h b/Source/Modio/Public/Libraries/ModioImageLibrary.h index d024f60d..14091e4b 100644 --- a/Source/Modio/Public/Libraries/ModioImageLibrary.h +++ b/Source/Modio/Public/Libraries/ModioImageLibrary.h @@ -1,4 +1,14 @@ -#pragma once +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once #include "Kismet/BlueprintFunctionLibrary.h" #include "Types/ModioCommonTypes.h" #include "Types/ModioImage.h" diff --git a/Source/Modio/Public/Libraries/ModioModCollectionLibrary.h b/Source/Modio/Public/Libraries/ModioModCollectionLibrary.h index 64049174..ea8c5e6d 100644 --- a/Source/Modio/Public/Libraries/ModioModCollectionLibrary.h +++ b/Source/Modio/Public/Libraries/ModioModCollectionLibrary.h @@ -1,4 +1,14 @@ -#pragma once +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once #include "Kismet/BlueprintFunctionLibrary.h" #include "Types/ModioModCollectionEntry.h" @@ -30,5 +40,5 @@ class UModioModCollectionLibrary : public UBlueprintFunctionLibrary * xref:GetModState[] before trying to load files in this location **/ UFUNCTION(BlueprintPure, Category = "mod.io|Mods") - static const FString& GetPath(const FModioModCollectionEntry& Entry); + static const FString GetPath(const FModioModCollectionEntry& Entry); }; diff --git a/Source/Modio/Public/Libraries/ModioModInfoListLibrary.h b/Source/Modio/Public/Libraries/ModioModInfoListLibrary.h index 74f72cb7..bbebca2f 100644 --- a/Source/Modio/Public/Libraries/ModioModInfoListLibrary.h +++ b/Source/Modio/Public/Libraries/ModioModInfoListLibrary.h @@ -1,4 +1,14 @@ -#pragma once +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once #include "Kismet/BlueprintFunctionLibrary.h" #include "Types/ModioModInfoList.h" diff --git a/Source/Modio/Public/Libraries/ModioModTagOptionsLibrary.h b/Source/Modio/Public/Libraries/ModioModTagOptionsLibrary.h index c3a0ab1b..18018164 100644 --- a/Source/Modio/Public/Libraries/ModioModTagOptionsLibrary.h +++ b/Source/Modio/Public/Libraries/ModioModTagOptionsLibrary.h @@ -1,4 +1,14 @@ -#pragma once +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once #include "Kismet/BlueprintFunctionLibrary.h" #include "Types/ModioModTagOptions.h" diff --git a/Source/Modio/Public/Libraries/ModioOptionalLibrary.h b/Source/Modio/Public/Libraries/ModioOptionalLibrary.h index 5e9c6bdd..f514d6dd 100644 --- a/Source/Modio/Public/Libraries/ModioOptionalLibrary.h +++ b/Source/Modio/Public/Libraries/ModioOptionalLibrary.h @@ -1,7 +1,18 @@ -#pragma once +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once #include "Kismet/BlueprintFunctionLibrary.h" #include "Types/ModioModInfo.h" +#include "Types/ModioModInfoList.h" #include "Types/ModioModProgressInfo.h" #include "Types/ModioModTagOptions.h" #include "Types/ModioTerms.h" diff --git a/Source/Modio/Public/Libraries/ModioReportLibrary.h b/Source/Modio/Public/Libraries/ModioReportLibrary.h new file mode 100644 index 00000000..32683c70 --- /dev/null +++ b/Source/Modio/Public/Libraries/ModioReportLibrary.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "Kismet/BlueprintFunctionLibrary.h" +#include "Misc/Optional.h" +#include "Types/ModioReportParams.h" +#include "Types/ModioCommonTypes.h" + +#include "ModioReportLibrary.generated.h" + + +/** + * + */ +UCLASS() +class MODIO_API UModioReportLibrary : public UBlueprintFunctionLibrary +{ + GENERATED_BODY() + /// @brief Creates a content report for a game. + /// @param Game The ID of the game being reported + /// @param Type The nature of the content report + /// @param ReportDescription A description of why the content is being reported + /// @param ReporterName Name of the submitting user. Recommended for DMCA reports, but may be empty + /// @param ReporterContact Contact details of the submitting user. Recommended for DMCA reports, but may be + /// empty + UFUNCTION(BlueprintCallable, BlueprintPure, Category = "mod.io|Content Reporting") + static FModioReportParams MakeReportForGame(FModioGameID Game, EModioReportType Type, + FString ReportDescription, FString ReporterName, + FString ReporterContact); + + /// @docpublic + /// @brief Creates a content report for a game. + /// @param User The ID of the User being reported + /// @param Type The nature of the content report + /// @param ReportDescription A description of why the content is being reported + /// @param ReporterName Name of the submitting user. Recommended for DMCA reports, but may be empty + /// @param ReporterContact Contact details of the submitting user. Recommended for DMCA reports, but may be + /// empty + UFUNCTION(BlueprintCallable, BlueprintPure, Category = "mod.io|Content Reporting") + static FModioReportParams MakeReportForUser(FModioUserID User, EModioReportType Type, + FString ReportDescription, FString ReporterName, + FString ReporterContact); + + /// @docpublic + /// @brief Creates a content report for a game. + /// @param Mod The ID of the content being reported + /// @param Type The nature of the content report + /// @param ReportDescription A description of why the content is being reported + /// @param ReporterName Name of the submitting user. Recommended for DMCA reports, but may be empty + /// @param ReporterContact Contact details of the submitting user. Recommended for DMCA reports, but may be + /// empty + UFUNCTION(BlueprintCallable, BlueprintPure, Category = "mod.io|Content Reporting") + static FModioReportParams MakeReportForMod(FModioModID Mod, EModioReportType Type, FString ReportDescription, + FString ReporterName, FString ReporterContact); +}; diff --git a/Source/Modio/Public/Libraries/ModioSDKLibrary.h b/Source/Modio/Public/Libraries/ModioSDKLibrary.h index 531d0dbb..89a639c7 100644 --- a/Source/Modio/Public/Libraries/ModioSDKLibrary.h +++ b/Source/Modio/Public/Libraries/ModioSDKLibrary.h @@ -1,4 +1,14 @@ -#pragma once +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once #include "Kismet/BlueprintFunctionLibrary.h" #include "Types/ModioInitializeOptions.h" diff --git a/Source/Modio/Public/Modio.h b/Source/Modio/Public/Modio.h index c425ecdc..fce5b020 100644 --- a/Source/Modio/Public/Modio.h +++ b/Source/Modio/Public/Modio.h @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. #pragma once diff --git a/Source/Modio/Public/ModioImageCache.h b/Source/Modio/Public/ModioImageCache.h index 040d4e5b..876bd682 100644 --- a/Source/Modio/Public/ModioImageCache.h +++ b/Source/Modio/Public/ModioImageCache.h @@ -1,4 +1,14 @@ -#pragma once +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once #include "UObject/WeakObjectPtr.h" #include "Types/ModioImageState.h" diff --git a/Source/Modio/Public/ModioSDK.h b/Source/Modio/Public/ModioSDK.h index 1af10d13..c0dfd170 100644 --- a/Source/Modio/Public/ModioSDK.h +++ b/Source/Modio/Public/ModioSDK.h @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #pragma once //#if PLATFORM_WINDOWS @@ -10,19 +20,6 @@ #define MODIO_PLATFORM_UNREAL 1 -// Ensure that we can run asio without any exceptions -namespace asio -{ - namespace detail - { - template - void throw_exception(const Exception& e) - { - checkf(false, TEXT("Asio threw a exception with the message %s"), *e.what()); - } - } // namespace detail -} // namespace asio - #pragma push_macro("check") #undef check diff --git a/Source/Modio/Classes/ModioSettings.h b/Source/Modio/Public/ModioSettings.h similarity index 82% rename from Source/Modio/Classes/ModioSettings.h rename to Source/Modio/Public/ModioSettings.h index ecd3bd92..1d6b7a43 100644 --- a/Source/Modio/Classes/ModioSettings.h +++ b/Source/Modio/Public/ModioSettings.h @@ -1,4 +1,14 @@ -#pragma once +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once #include "Types/ModioCommonTypes.h" diff --git a/Source/Modio/Public/ModioSubsystem.h b/Source/Modio/Public/ModioSubsystem.h index 34e53ceb..003e09f3 100644 --- a/Source/Modio/Public/ModioSubsystem.h +++ b/Source/Modio/Public/ModioSubsystem.h @@ -1,7 +1,16 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #pragma once #include "ModioImageCache.h" -#include "ModioSDK.h" #include "Subsystems/EngineSubsystem.h" #include "Types/ModioAuthenticationParams.h" #include "Types/ModioCommonTypes.h" @@ -15,6 +24,8 @@ #include "Types/ModioModManagementEvent.h" #include "Types/ModioModProgressInfo.h" #include "Types/ModioModTagOptions.h" +#include "Types/ModioRating.h" +#include "Types/ModioReportParams.h" #include "Types/ModioTerms.h" #include "Types/ModioUser.h" #include "Types/ModioValidationError.h" @@ -386,6 +397,36 @@ class UModioSubsystem : public UEngineSubsystem **/ MODIO_API void GetUserMediaAsync(EModioAvatarSize AvatarSize, FOnGetMediaDelegateFast Callback); + + /** + * @brief Submits a rating for a mod on behalf of the current user. Submit a neutral rating to effectively clear a + * rating already submitted by a user. Submitting other values will overwrite any existing rating submitted by this + * user. + * @param Mod The mod the user is rating + * @param Rating The rating the user wishes to submit + * @requires initialized-sdk + * @requires authenticated-user + * @requires no-rate-limiting + * @errorcategory NetworkError|Couldn't connect to mod.io servers + * @error GenericError::SDKNotInitialized|SDK not initialized + * @errorcategory EntityNotFoundError|Specified mod could not be found + * @error UserDataError::InvalidUser|No authenticated user + */ + MODIO_API void SubmitModRatingAsync(FModioModID Mod, EModioRating Rating, FOnErrorOnlyDelegateFast Callback); + + /** + * @brief Sends a content report to mod.io. When using this function, please inform your users that if they provide + * their contact name or details in the Report parameter, that those may be shared with the person responsible for + * the content being reported. For more information on what data in a report will be shared with whom, please see + * link:https://mod.io/report/widget[our website's report form] for more information. + * @param Report Information about the content being reported and a description of the report. + * @param Callback Callback providing a status code to indicate successful submission of the report. + * @requires initialized-sdk + * @errorcategory NetworkError|Couldn't Connect to mod.io servers + * @errorcategory InvalidArgsError|Required information in the report did not pass validation + */ + MODIO_API void ReportContentAsync(FModioReportParams Report, FOnErrorOnlyDelegateFast Callback); + /** Get our image cache */ struct FModioImageCache& GetImageCache() const; @@ -680,5 +721,37 @@ class UModioSubsystem : public UEngineSubsystem **/ UFUNCTION(BlueprintCallable, DisplayName = "GetUserMediaAsync (Avatar)", Category = "mod.io|User") MODIO_API void K2_GetUserMediaAvatarAsync(EModioAvatarSize AvatarSize, FOnGetMediaDelegate Callback); + + /** + * @brief Submits a rating for a mod on behalf of the current user. Submit a neutral rating to effectively clear a + * rating already submitted by a user. Submitting other values will overwrite any existing rating submitted by this + * user. + * @param Mod The mod the user is rating + * @param Rating The rating the user wishes to submit + * @requires initialized-sdk + * @requires authenticated-user + * @requires no-rate-limiting + * @errorcategory NetworkError|Couldn't connect to mod.io servers + * @error GenericError::SDKNotInitialized|SDK not initialized + * @errorcategory EntityNotFoundError|Specified mod could not be found + * @error UserDataError::InvalidUser|No authenticated user + */ + UFUNCTION(BlueprintCallable, DisplayName = "SubmitModRatingAsync", Category = "mod.io|Mods") + MODIO_API void K2_SubmitModRatingAsync(FModioModID Mod, EModioRating Rating, FOnErrorOnlyDelegate Callback); + + /** + * @brief Sends a content report to mod.io. When using this function, please inform your users that if they provide + * their contact name or details in the Report parameter, that those may be shared with the person responsible for + * the content being reported. For more information on what data in a report will be shared with whom, please see + * link:https://mod.io/report/widget[our website's report form] for more information. + * @param Report Information about the content being reported and a description of the report. + * @param Callback Callback providing a status code to indicate successful submission of the report. + * @requires initialized-sdk + * @errorcategory NetworkError|Couldn't Connect to mod.io servers + * @errorcategory InvalidArgsError|Required information in the report did not pass validation + */ + UFUNCTION(BlueprintCallable, DisplayName = "ReportContentAsync", Category = "mod.io") + MODIO_API void K2_ReportContentAsync(FModioReportParams Report, FOnErrorOnlyDelegate Callback); + #pragma endregion }; diff --git a/Source/Modio/Public/Types/ModioAuthenticationParams.h b/Source/Modio/Public/Types/ModioAuthenticationParams.h new file mode 100644 index 00000000..b24485b9 --- /dev/null +++ b/Source/Modio/Public/Types/ModioAuthenticationParams.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once + +#include "Containers/UnrealString.h" + +#include "ModioAuthenticationParams.generated.h" + +/** @brief Simple struct to encapsulate data passed to external authentication systems */ +UENUM(BlueprintType) +enum class EModioAuthenticationProvider : uint8 +{ + XboxLive, + Steam, + GoG, + Itch, + Switch, + Discord +}; + +/** @brief Simple struct to encapsulate data passed to external authentication systems */ +USTRUCT(BlueprintType) +struct FModioAuthenticationParams +{ + GENERATED_BODY(); + UPROPERTY(BlueprintReadWrite, EditInstanceOnly) + FString AuthToken; + UPROPERTY(BlueprintReadWrite, EditInstanceOnly) + FString UserEmail; + UPROPERTY(BlueprintReadWrite, EditInstanceOnly) + bool bUserHasAcceptedTerms = false; +}; diff --git a/Source/Modio/Public/Types/ModioCommonTypes.h b/Source/Modio/Public/Types/ModioCommonTypes.h new file mode 100644 index 00000000..f5e01f2a --- /dev/null +++ b/Source/Modio/Public/Types/ModioCommonTypes.h @@ -0,0 +1,376 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once +#include "Misc/Crc.h" + +// clang-format off +#include "ModioCommonTypes.generated.h" +// clang-format on + +//Forward decls +namespace Modio +{ + struct ModID; + struct GameID; + struct FileMetadataID; + struct UserID; +} + + +/** @brief Enum representing what environment your game is deployed in */ +UENUM(BlueprintType) +enum class EModioEnvironment : uint8 +{ + // Test/Private environment + Test, + // Live/Public environment + Live +}; + +/** @brief Enum representing the store or service your game is being distributed through */ +UENUM(BlueprintType) +enum class EModioPortal : uint8 +{ + None, + Apple, + EpicGamesStore, + GOG, + Google, + Itchio, + Nintendo, + PSN, + Steam, + XboxLive +}; + +/** @brief Enum representing mod logo sizes */ +UENUM(BlueprintType) +enum class EModioLogoSize : uint8 +{ + // Original Size + Original, + // 320x180px + Thumb320, + // 640x360px + Thumb640, + // 1280x720px + Thumb1280 +}; + +/** @brief Enum representing avatar image sizes */ +UENUM(BlueprintType) +enum class EModioAvatarSize : uint8 +{ + // Original Size + Original, + // 50x50px Thumbnail + Thumb50, + // 100x100px Thumbnail + Thumb100 +}; + +/** */ +UENUM(BlueprintType) +enum class EModioGallerySize : uint8 +{ + // Original Size + Original, + // 320x180px Thumbnail + Thumb320 +}; + +/** @brief Degree of severity for the log output */ +UENUM() +enum class EModioLogLevel : uint8 +{ + // Detailed low-level debugging output. Not intended for general use + Trace = 0, + // Informational output containing status messages + Info = 1, + // Warnings about incorrect plugin usage, timeouts + Warning = 2, + // Only errors + Error = 3 +}; + +/** @brief Enum representing the languages mod.io support responses in */ +UENUM(BlueprintType) +enum class EModioLanguage : uint8 +{ + English, + Bulgarian, + French, + German, + Italian, + Polish, + Portuguese, + Hungarian, + Japanese, + Korean, + Russian, + Spanish, + Thai, + ChineseSimplified, + ChineseTraditional +}; + +/** @brief Strong type for Mod IDs */ +USTRUCT(BlueprintType) +struct MODIO_API FModioModID +{ + GENERATED_BODY() + + FModioModID(); + constexpr explicit FModioModID(int64 InModId) : ModID(InModId) {} + + friend uint32 GetTypeHash(FModioModID ModioModId); + + friend bool operator==(FModioModID A, FModioModID B) + { + return A.ModID == B.ModID; + } + + friend bool operator!=(FModioModID A, FModioModID B) + { + return A.ModID != B.ModID; + } + + friend bool operator<(FModioModID A, FModioModID B) + { + return A.ModID < B.ModID; + } + + friend bool operator>(FModioModID A, FModioModID B) + { + return A.ModID > B.ModID; + } + + FString ToString() const + { + if (ModID < 0) + { + return TEXT("InvalidModID"); + } + return FString::Printf(TEXT("%lld"), ModID); + } + +private: + friend struct Modio::ModID ToModio(const FModioModID& In); + int64 ModID; +}; + +template<> +struct TStructOpsTypeTraits : public TStructOpsTypeTraitsBase2 +{ + enum + { + WithIdenticalViaEquality = true + }; +}; + +/** @brief Strong type for Game IDs */ +USTRUCT(BlueprintType, meta = (HasNativeMake = "Modio.ModioCommonTypesLibrary.MakeGameId")) +struct MODIO_API FModioGameID +{ + GENERATED_BODY() + + FModioGameID(); + constexpr explicit FModioGameID(int64 InGameId) : GameID(InGameId) {} + + friend uint32 GetTypeHash(FModioGameID ModioGameId); + + friend bool operator==(FModioGameID A, FModioGameID B) + { + return A.GameID == B.GameID; + } + + FString ToString() const + { + if (GameID < 0) + { + return TEXT("InvalidGameID"); + } + return FString::Printf(TEXT("%lld"), GameID); + } + + static FModioGameID InvalidGameID(); + +private: + friend struct Modio::GameID ToModio(const FModioGameID& In); + int64 GameID; +}; + +template<> +struct TStructOpsTypeTraits : public TStructOpsTypeTraitsBase2 +{ + enum + { + WithIdenticalViaEquality = true + }; +}; + +/** @brief Strong type for File Metadata IDs */ +USTRUCT(BlueprintType) +struct MODIO_API FModioFileMetadataID +{ + GENERATED_BODY() + + FModioFileMetadataID(); + constexpr explicit FModioFileMetadataID(int64 InFileMetadataId) : FileMetadataID(InFileMetadataId) {} + + friend uint32 GetTypeHash(FModioFileMetadataID FileMetadataID); + + friend bool operator==(FModioFileMetadataID A, FModioFileMetadataID B) + { + return A.FileMetadataID == B.FileMetadataID; + } + + FString ToString() const + { + if (FileMetadataID < 0) + { + return TEXT("InvalidFileMetadataID"); + } + return FString::Printf(TEXT("%lld"), FileMetadataID); + } + +private: + friend struct Modio::FileMetadataID ToModio(const FModioFileMetadataID& In); + int64 FileMetadataID; +}; + +template<> +struct TStructOpsTypeTraits : public TStructOpsTypeTraitsBase2 +{ + enum + { + WithIdenticalViaEquality = true + }; +}; + +/** @brief Strong type for User IDs */ +USTRUCT(BlueprintType) +struct MODIO_API FModioUserID +{ + GENERATED_BODY() + + FModioUserID(); + + constexpr explicit FModioUserID(int64 InUserID) : UserID(InUserID) {} + + friend uint32 GetTypeHash(FModioUserID UserID); + + friend bool operator==(FModioUserID A, FModioUserID B) + { + return A.UserID == B.UserID; + } + + FString ToString() const + { + if (UserID < 0) + { + return TEXT("InvalidUserID"); + } + return FString::Printf(TEXT("%lld"), UserID); + } + +private: + friend struct Modio::UserID ToModio(const FModioUserID& In); + int64 UserID; +}; + +template<> +struct TStructOpsTypeTraits : public TStructOpsTypeTraitsBase2 +{ + enum + { + WithIdenticalViaEquality = true + }; +}; + +/** @brief Strong type for Api Keys */ +USTRUCT(BlueprintType, meta = (HasNativeMake = "Modio.ModioCommonTypesLibrary.MakeApiKey")) +struct MODIO_API FModioApiKey +{ + GENERATED_BODY() + + FModioApiKey() = default; + explicit FModioApiKey(const FString& InApiKey); + + const FString& ToString() const + { + // Put in the function instead of default constructor to avoid having to allocate memory for + // each empty instance + if (ApiKey.Len() == 0) + { + static FString Invalid(TEXT("InvalidApiKey")); + return Invalid; + } + return ApiKey; + } + + static FModioApiKey InvalidAPIKey(); + +private: + FString ApiKey; +}; + +/** @brief Strong type for email address */ +USTRUCT(BlueprintType) +struct MODIO_API FModioEmailAddress +{ + GENERATED_BODY() + + FModioEmailAddress() = default; + FModioEmailAddress(const FString& InEmailAddress); + + const FString& ToString() const + { + // Put in the function instead of default constructor to avoid having to allocate memory for + // each empty instance + if (EmailAddress.Len() == 0) + { + static FString Invalid(TEXT("InvalidEmailAddress")); + return Invalid; + } + return EmailAddress; + } + +private: + FString EmailAddress; +}; + +/** @brief Strong type for email auth code */ +USTRUCT(BlueprintType) +struct MODIO_API FModioEmailAuthCode +{ + GENERATED_BODY() + + FModioEmailAuthCode() = default; + FModioEmailAuthCode(const FString& InEmailAuthCode); + + const FString& ToString() const + { + // Put in the function instead of default constructor to avoid having to allocate memory for + // each empty instance + if (EmailAuthCode.Len() == 0) + { + static FString Invalid(TEXT("InvalidEmailAuthCode")); + return Invalid; + } + return EmailAuthCode; + } + +private: + FString EmailAuthCode; +}; + +#pragma endregion diff --git a/Source/Modio/Public/Types/ModioErrorCode.h b/Source/Modio/Public/Types/ModioErrorCode.h new file mode 100644 index 00000000..b07e95e8 --- /dev/null +++ b/Source/Modio/Public/Types/ModioErrorCode.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once +#include "Templates/UniquePtr.h" + +// clang-format off +#include "ModioErrorCode.generated.h" +// clang-format on + +namespace Modio +{ + class ErrorCode; +} + +/** @brief wrapper around Modio::ErrorCode */ +USTRUCT(BlueprintType) +struct MODIO_API FModioErrorCode +{ + GENERATED_BODY() + + // This is to allow delegates to pass FModioErrorCode code, but I would have preferred it to be deleted + FModioErrorCode(); + FModioErrorCode(const FModioErrorCode& Other); + FModioErrorCode(Modio::ErrorCode ec); + FModioErrorCode& operator=(const FModioErrorCode& ec); + ~FModioErrorCode(); + /** return true if this error code is a error */ + operator bool() const; + + /** Get the error code */ + int GetValue() const; + Modio::ErrorCode GetRawErrorCode() const; + + /** Get a human readable message from the error code */ + FString GetMessage() const; + +private: + TUniquePtr Error; +}; + diff --git a/Source/Modio/Classes/Types/ModioFileMetadata.h b/Source/Modio/Public/Types/ModioFileMetadata.h similarity index 57% rename from Source/Modio/Classes/Types/ModioFileMetadata.h rename to Source/Modio/Public/Types/ModioFileMetadata.h index 7cdfcb24..80b01163 100644 --- a/Source/Modio/Classes/Types/ModioFileMetadata.h +++ b/Source/Modio/Public/Types/ModioFileMetadata.h @@ -1,7 +1,15 @@ -#pragma once +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once -#include "Internal/ModioPrivateDefines.h" -#include "ModioSDK.h" #include "Types/ModioCommonTypes.h" // clang-format off #include "ModioFileMetadata.generated.h" @@ -33,9 +41,6 @@ struct MODIO_API FModioFileMetadata { GENERATED_BODY() - FModioFileMetadata() = default; - FModioFileMetadata(const Modio::FileMetadata& FileMetadata); - /** @brief Unique modfile id. */ UPROPERTY(BlueprintReadOnly, Category = "FileMetadata") FModioFileMetadataID MetadataId; @@ -79,46 +84,3 @@ struct MODIO_API FModioFileMetadata UPROPERTY(BlueprintReadOnly, Category = "FileMetadata|Metadata") FString MetadataBlob; }; - -#pragma region ToUnreal implementation -FORCEINLINE FModioFileMetadata ToUnreal(const Modio::FileMetadata& FileMetadata) -{ - return FModioFileMetadata(FileMetadata); -} - -MODIO_BEGIN_CONVERT_SWITCHES -FORCEINLINE EModioVirusScanStatus ToUnreal(Modio::FileMetadata::VirusScanStatus VirusScanStatus) -{ - switch (VirusScanStatus) - { - case Modio::FileMetadata::VirusScanStatus::NotScanned: - return EModioVirusScanStatus::NotScanned; - case Modio::FileMetadata::VirusScanStatus::ScanComplete: - return EModioVirusScanStatus::ScanComplete; - case Modio::FileMetadata::VirusScanStatus::InProgress: - return EModioVirusScanStatus::InProgress; - case Modio::FileMetadata::VirusScanStatus::TooLargeToScan: - return EModioVirusScanStatus::TooLargeToScan; - case Modio::FileMetadata::VirusScanStatus::FileNotFound: - return EModioVirusScanStatus::FileNotFound; - case Modio::FileMetadata::VirusScanStatus::ErrorScanning: - return EModioVirusScanStatus::ErrorScanning; - } - - return EModioVirusScanStatus::NotScanned; -} - -FORCEINLINE EModioVirusStatus ToUnreal(Modio::FileMetadata::VirusStatus VirusStatus) -{ - switch (VirusStatus) - { - case Modio::FileMetadata::VirusStatus::NoThreat: - return EModioVirusStatus::NoThreat; - case Modio::FileMetadata::VirusStatus::Malicious: - return EModioVirusStatus::Malicious; - } - - return EModioVirusStatus::NoThreat; -} -MODIO_END_CONVERT_SWITCHES -#pragma endregion diff --git a/Source/Modio/Public/Types/ModioFilterParams.h b/Source/Modio/Public/Types/ModioFilterParams.h new file mode 100644 index 00000000..4157c803 --- /dev/null +++ b/Source/Modio/Public/Types/ModioFilterParams.h @@ -0,0 +1,172 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once + +#include "Types/ModioCommonTypes.h" + +// clang-format off +#include "ModioFilterParams.generated.h" +// clang-format on + +/// Forward declaration of SDK type for declaration of conversion function below +namespace Modio +{ + class FilterParams; +} + +/// @brief Enum indicating which field should be used to sort the results +UENUM(BlueprintType) +enum class EModioSortFieldType : uint8 +{ + ID, /** use mod ID (default) */ + DownloadsToday, /** use number of downloads in last 24 (exposed in REST API as 'popular' */ + SubscriberCount, /** use number of subscribers */ + Rating, /** use mod rating */ + DateMarkedLive, /** use date mod was marked live */ + DateUpdated /** use date mod was last updated */ +}; + +/// @brief Enum indicating which direction sorting should be applied +UENUM(BlueprintType) +enum class EModioSortDirection : uint8 +{ + Ascending, /** (default) */ + Descending +}; + +/** @brief Class storing a set of filter parameters for use in xref:ListAllModsAsync[] */ +USTRUCT(BlueprintType) +struct MODIO_API FModioFilterParams +{ + GENERATED_BODY() + + /** + * @brief Indicates the filter should only include the specified mods + * @param IDs the set of mods to match + * @return *this + */ + FModioFilterParams& MatchingIDs(const TArray& IDs); + + /** + * @brief Indicates the filter should exclude the specified mods. + * @param IDs the set of mods to exclude + * @return *this + */ + FModioFilterParams& ExcludingIDs(const TArray& IDs); + + /** + * @brief Indicates results should be sorted using the specified field and direction + * @param ByField Field to sort with + * @param ByDirection Direction to sort + * @return *this + **/ + FModioFilterParams& SortBy(EModioSortFieldType ByField, EModioSortDirection ByDirection); + + /** + * @brief Only include mods where the name contains the provided string + * @param SearchString Search string + * @return *this + **/ + FModioFilterParams& NameContains(const FString& SearchString); + + /** + * @brief Only include mods where the name contains at least one of the provided strings (string1 OR string2 OR + *stringN...) + * @tparam ...Args std::string + * @param SearchString First search string + * @param ...args Additional search strings + * @return *this + **/ + FModioFilterParams& NameContains(const TArray& SearchString); + + /** + * @brief Only include mods that were marked live (i.e released) after the specified date + * @param LiveAfter Minimum date + * @return *this + **/ + FModioFilterParams& MarkedLiveAfter(FDateTime LiveAfter); + + /** + * @brief Only include mods that were marked live (i.e released) before the specified date + * @param LiveBefore Maximum date + * @return *this + **/ + FModioFilterParams& MarkedLiveBefore(FDateTime LiveBefore); + + /** + * @brief Only include mods that have the specified tag + * @param Tag Tag to include + * @return *this + **/ + FModioFilterParams& WithTags(const FString& Tag); + + /** + * @brief Only include mods that have all the specified tags (tag1 AND tag2 AND tagN...) + * @param NewTags The set of tags to filter on + * @return *this + **/ + FModioFilterParams& WithTags(const TArray& NewTags); + + /** + * @brief Only include mods that do not have the specified tag + * @param Tag Tag to exclude + * @return *this + **/ + FModioFilterParams& WithoutTags(const FString& Tag); + + /** + * @brief Only include mods that do not have any of the specified tags ( NOT (tag1 OR tag2 OR tagN...)) + * @param NewTags Tags to exclude + * @return *this + **/ + FModioFilterParams& WithoutTags(const TArray& NewTags); + + /** + * @brief Returns a sub-range of query results from StartIndex to StartIndex + ResultCount + * @param StartIndex Zero-based index of first result to return + * @param ResultCount Number of results to return + * @return *this + **/ + FModioFilterParams& IndexedResults(uint64 StartIndex, uint64 ResultCount); + + /** + * @brief Returns a sub-range of query results based on a specified page size and index + * @param PageNumber Zero-based index of page to return + * @param PageSize Number of results in a page + * @return + **/ + FModioFilterParams& PagedResults(uint64 PageNumber, uint64 PageSize); + + /** + * @brief Converts the filter params to a string suitable for use in the REST API. + * @note Performs a allocation to acquire the string + * @return FString containing the filter parameters + */ + FString ToString() const; + +private: + + friend class Modio::FilterParams ToModio(const FModioFilterParams& In ); + + EModioSortDirection Direction = EModioSortDirection::Ascending; + EModioSortFieldType SortField = EModioSortFieldType::ID; + TArray SearchKeywords; + TOptional DateRangeBegin; + TOptional DateRangeEnd; + TArray Tags; + TArray ExcludedTags; + TArray IncludedIDs; + TArray ExcludedIDs; + + bool isPaged = false; + int64 Index = 0; + int64 Count = 100; +}; diff --git a/Source/Modio/Classes/Types/ModioImage.h b/Source/Modio/Public/Types/ModioImage.h similarity index 69% rename from Source/Modio/Classes/Types/ModioImage.h rename to Source/Modio/Public/Types/ModioImage.h index 9b2947fa..31cb366e 100644 --- a/Source/Modio/Classes/Types/ModioImage.h +++ b/Source/Modio/Public/Types/ModioImage.h @@ -1,12 +1,20 @@ -#pragma once +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once #include "Containers/UnrealString.h" -#include "ModioSDK.h" #include "Types/ModioImageState.h" -// clang-format off #include "ModioImage.generated.h" -// clang-format on + DECLARE_DELEGATE_OneParam(FOnLoadImageDelegateFast, class UTexture2DDynamic*); @@ -16,9 +24,6 @@ struct MODIO_API FModioImage { GENERATED_BODY() - FModioImage() = default; - FModioImage(const Modio::filesystem::path& Path); - /** Get the texture if if has been loaded by any FModioImage instance */ class UTexture2DDynamic* GetTexture() const; @@ -49,21 +54,5 @@ struct FModioOptionalImage { GENERATED_BODY() - // This is here due to it was needed once, but now I get crashes if I remove it - bool Serialize(FArchive& Ar) - { - return true; - } - TOptional Internal; }; - -// This is here due to it was needed once, but now I get crashes if I remove it -template<> -struct TStructOpsTypeTraits : public TStructOpsTypeTraitsBase2 -{ - enum - { - WithSerializer = true - }; -}; diff --git a/Source/Modio/Public/Types/ModioImageState.h b/Source/Modio/Public/Types/ModioImageState.h new file mode 100644 index 00000000..1541ac37 --- /dev/null +++ b/Source/Modio/Public/Types/ModioImageState.h @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once + +// clang-format off +#include "ModioImageState.generated.h" +// clang-format on + +UENUM(BlueprintType) +enum class EModioImageState : uint8 +{ + OnDisc, + LoadingIntoMemory, + InMemory, + Corrupted +}; \ No newline at end of file diff --git a/Source/Modio/Classes/Types/ModioInitializeOptions.h b/Source/Modio/Public/Types/ModioInitializeOptions.h similarity index 67% rename from Source/Modio/Classes/Types/ModioInitializeOptions.h rename to Source/Modio/Public/Types/ModioInitializeOptions.h index 350dee72..307846b2 100644 --- a/Source/Modio/Classes/Types/ModioInitializeOptions.h +++ b/Source/Modio/Public/Types/ModioInitializeOptions.h @@ -1,6 +1,15 @@ -#pragma once +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once -#include "ModioSDK.h" #include "Types/ModioCommonTypes.h" // clang-format off @@ -12,16 +21,13 @@ struct FModioInitializeOptions { GENERATED_BODY() - /** Implicitly convert it to the underlying type */ - operator Modio::InitializeOptions() const; - /** @brief The Mod.io-provided ID for the game */ UPROPERTY(BlueprintReadOnly, Category = "mod.io") - FModioGameID GameID = FModioGameID::InvalidGameID(); + FModioGameID GameId = FModioGameID::InvalidGameID(); /** @brief The Mod.io-provided API key for your application or game */ UPROPERTY(BlueprintReadOnly, Category = "mod.io") - FModioApiKey APIKey = FModioApiKey::InvalidAPIKey(); + FModioApiKey ApiKey = FModioApiKey::InvalidAPIKey(); /** @brief The mod.io environment you want to run the SDK on */ UPROPERTY(BlueprintReadOnly, Category = "mod.io") diff --git a/Source/Modio/Classes/Types/ModioList.h b/Source/Modio/Public/Types/ModioList.h similarity index 90% rename from Source/Modio/Classes/Types/ModioList.h rename to Source/Modio/Public/Types/ModioList.h index 9986ee80..4e45ccf8 100644 --- a/Source/Modio/Classes/Types/ModioList.h +++ b/Source/Modio/Public/Types/ModioList.h @@ -1,6 +1,15 @@ -#pragma once +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once -#include "ModioSDK.h" #include "Templates/UnrealTemplate.h" #include "Internal/ModioConvert.h" diff --git a/Source/Modio/Classes/Types/ModioMetadata.h b/Source/Modio/Public/Types/ModioMetadata.h similarity index 56% rename from Source/Modio/Classes/Types/ModioMetadata.h rename to Source/Modio/Public/Types/ModioMetadata.h index 4cea9021..90d43ed6 100644 --- a/Source/Modio/Classes/Types/ModioMetadata.h +++ b/Source/Modio/Public/Types/ModioMetadata.h @@ -1,4 +1,14 @@ -#pragma once +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once #include "Containers/UnrealString.h" @@ -6,19 +16,11 @@ #include "ModioMetadata.generated.h" // clang-format on -namespace Modio -{ - struct Metadata; -} - USTRUCT(BlueprintType) struct MODIO_API FModioMetadata { GENERATED_BODY() - FModioMetadata() = default; - FModioMetadata(const Modio::Metadata& Metadata); - /** Key of the metadata */ UPROPERTY(BlueprintReadOnly, Category = "Metadata") FString Key; @@ -27,10 +29,3 @@ struct MODIO_API FModioMetadata UPROPERTY(BlueprintReadOnly, Category = "Metadata") FString Value; }; - -#pragma region ToUnreal implementation -FORCEINLINE FModioMetadata ToUnreal(const Modio::Metadata& Metadata) -{ - return FModioMetadata(Metadata); -} -#pragma endregion diff --git a/Source/Modio/Public/Types/ModioModCollectionEntry.h b/Source/Modio/Public/Types/ModioModCollectionEntry.h new file mode 100644 index 00000000..22490b3e --- /dev/null +++ b/Source/Modio/Public/Types/ModioModCollectionEntry.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once + +#include "Types/ModioCommonTypes.h" +#include "Types/ModioModInfo.h" + +// clang-format off +#include "ModioModCollectionEntry.generated.h" +// clang-format on + + +/// @brief Enum representing the current state of a mod +UENUM(BlueprintType) +enum class EModioModState : uint8 +{ + InstallationPending, // dont save + Installed, + UpdatePending, // saved as installed + Downloading, // installing - dont save + Extracting, // installing- don't save + UninstallPending, // saved as installed +}; + +/** @brief Class representing a mod which is installed locally */ +USTRUCT(BlueprintType) +struct MODIO_API FModioModCollectionEntry +{ + GENERATED_BODY() + + EModioModState GetModState() const; + + FModioModID GetID() const; + + const FModioModInfo& GetModProfile() const; + + const FString GetPath() const; + +private: + friend struct FModioModCollectionEntry ToUnreal(const class Modio::ModCollectionEntry& In); + + EModioModState ModState; + FModioModID ModID; + TOptional ModPath; + FModioModInfo ModProfile; +}; diff --git a/Source/Modio/Classes/Types/ModioModInfo.h b/Source/Modio/Public/Types/ModioModInfo.h similarity index 90% rename from Source/Modio/Classes/Types/ModioModInfo.h rename to Source/Modio/Public/Types/ModioModInfo.h index 590dc21a..7ecbb0ff 100644 --- a/Source/Modio/Classes/Types/ModioModInfo.h +++ b/Source/Modio/Public/Types/ModioModInfo.h @@ -1,6 +1,15 @@ -#pragma once +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once -#include "ModioSDK.h" #include "Types/ModioFileMetadata.h" #include "Types/ModioMetadata.h" #include "Types/ModioModStats.h" @@ -23,10 +32,6 @@ struct MODIO_API FModioModInfo { GENERATED_BODY() - FModioModInfo() = default; - FModioModInfo(const Modio::ModInfo& ModInfo); - FModioModInfo(const FModioModInfo& ModInfo) = default; - /** @brief Unique Mod ID */ UPROPERTY(BlueprintReadOnly, Category = "ModInfo") FModioModID ModId; @@ -111,6 +116,7 @@ struct MODIO_API FModioModInfo /** @brief Stats and rating information for the mod */ UPROPERTY(BlueprintReadOnly, Category = "Stats") FModioModStats Stats; + friend struct FModioModInfo ToUnreal(const struct Modio::ModInfo& In); }; USTRUCT(BlueprintType) @@ -120,10 +126,3 @@ struct FModioOptionalModInfo TOptional Internal; }; - -#pragma region ToUnreal implementation -FORCEINLINE FModioModInfo ToUnreal(const Modio::ModInfo& ModInfo) -{ - return FModioModInfo(ModInfo); -} -#pragma endregion diff --git a/Source/Modio/Classes/Types/ModioModInfoList.h b/Source/Modio/Public/Types/ModioModInfoList.h similarity index 74% rename from Source/Modio/Classes/Types/ModioModInfoList.h rename to Source/Modio/Public/Types/ModioModInfoList.h index afcdeda8..eb3ed427 100644 --- a/Source/Modio/Classes/Types/ModioModInfoList.h +++ b/Source/Modio/Public/Types/ModioModInfoList.h @@ -1,6 +1,15 @@ -#pragma once +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once -#include "ModioSDK.h" #include "Types/ModioList.h" #include "Types/ModioModInfo.h" #include "Types/ModioPagedResult.h" @@ -14,7 +23,7 @@ struct MODIO_API FModioModInfoList : public FModioPagedResult, public FModioList { FModioModInfoList() = default; FModioModInfoList(const FModioPagedResult& PagedResult, TArray&& ModInfoList); - FModioModInfoList(const Modio::ModInfoList& ModInfoList); + FModioModInfoList(const class Modio::ModInfoList& ModInfoList); }; #else @@ -43,9 +52,3 @@ struct MODIO_API FModioOptionalModInfoList TOptional Internal; }; -#pragma region ToUnreal implementation -FORCEINLINE FModioModInfoList ToModio(const Modio::ModInfoList& ModInfoList) -{ - return FModioModInfoList(ModInfoList); -} -#pragma endregion diff --git a/Source/Modio/Public/Types/ModioModManagementEvent.h b/Source/Modio/Public/Types/ModioModManagementEvent.h new file mode 100644 index 00000000..00a62f7e --- /dev/null +++ b/Source/Modio/Public/Types/ModioModManagementEvent.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once + +#include "Types/ModioCommonTypes.h" +#include "Types/ModioErrorCode.h" + +// clang-format off +#include "ModioModManagementEvent.generated.h" +// clang-format on + +/** @brief What type of event occurred */ +UENUM(BlueprintType) +enum class EModioModManagementEventType : uint8 +{ + Installed, /** Mod installation to local storage */ + Uninstalled, /** Mod uninstallation from local storage*/ + Updated /** Mod local installation updated to latest version*/ +}; + +/** @brief Simple struct representing the outcome of a mod management operation */ +USTRUCT(BlueprintType) +struct MODIO_API FModioModManagementEvent +{ + GENERATED_BODY() + + /** @brief ID for the mod that the event occurred on */ + UPROPERTY(BlueprintReadOnly,Category="ModManagementEvent") + FModioModID ID; + + /** @brief What type of event occurred */ + UPROPERTY(BlueprintReadOnly,Category="ModManagementEvent") + EModioModManagementEventType Event; + + /** @brief Empty if operation completed successfully, truthy/contains error code if operation failed */ + UPROPERTY(BlueprintReadOnly,Category="ModManagementEvent") + FModioErrorCode Status; +}; + diff --git a/Source/Modio/Classes/Types/ModioModProgressInfo.h b/Source/Modio/Public/Types/ModioModProgressInfo.h similarity index 73% rename from Source/Modio/Classes/Types/ModioModProgressInfo.h rename to Source/Modio/Public/Types/ModioModProgressInfo.h index 77737128..88fe2d58 100644 --- a/Source/Modio/Classes/Types/ModioModProgressInfo.h +++ b/Source/Modio/Public/Types/ModioModProgressInfo.h @@ -1,11 +1,18 @@ -#pragma once +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once -#include "ModioSDK.h" #include "Types/ModioCommonTypes.h" -// clang-format off #include "ModioModProgressInfo.generated.h" -// clang-format on namespace Modio { @@ -18,9 +25,6 @@ struct MODIO_API FModioModProgressInfo { GENERATED_BODY() - FModioModProgressInfo() = default; - FModioModProgressInfo(const Modio::ModProgressInfo& ModProgressInfo); - /** @brief Total size of the downloaded file */ UPROPERTY(BlueprintReadOnly,Category="ModProgressInfo") int64 TotalDownloadSize; @@ -50,9 +54,3 @@ struct FModioOptionalModProgressInfo TOptional Internal; }; -#pragma region ToUnreal implementation -FORCEINLINE FModioModProgressInfo ToUnreal(const Modio::ModProgressInfo& ModProgressInfo) -{ - return FModioModProgressInfo(ModProgressInfo); -} -#pragma region ToUnreal implementation diff --git a/Source/Modio/Classes/Types/ModioModStats.h b/Source/Modio/Public/Types/ModioModStats.h similarity index 87% rename from Source/Modio/Classes/Types/ModioModStats.h rename to Source/Modio/Public/Types/ModioModStats.h index 8085c83b..c89f9821 100644 --- a/Source/Modio/Classes/Types/ModioModStats.h +++ b/Source/Modio/Public/Types/ModioModStats.h @@ -1,15 +1,18 @@ -#pragma once +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once #include "Containers/UnrealString.h" -namespace Modio -{ - struct ModStats; -} - -// clang-format off #include "ModioModStats.generated.h" -// clang-format on /** @brief Contains download stats and ratings for a mod */ USTRUCT(BlueprintType) @@ -17,9 +20,6 @@ struct MODIO_API FModioModStats { GENERATED_BODY() - FModioModStats() = default; - FModioModStats(const Modio::ModStats& Stats); - /** @brief Current rank of the mod. */ UPROPERTY(BlueprintReadOnly, Category = "ModStats|Popularity") int64 PopularityRankPosition; @@ -71,10 +71,3 @@ struct MODIO_API FModioModStats UPROPERTY(BlueprintReadOnly, Category = "ModStats|Rating") FString RatingDisplayText; }; - -#pragma region ToUnreal implementation -FORCEINLINE FModioModStats ToUnreal(const Modio::ModStats& Stats) -{ - return FModioModStats(Stats); -} -#pragma endregion diff --git a/Source/Modio/Public/Types/ModioModTag.h b/Source/Modio/Public/Types/ModioModTag.h new file mode 100644 index 00000000..c28931c9 --- /dev/null +++ b/Source/Modio/Public/Types/ModioModTag.h @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once + +#include "Containers/UnrealString.h" + +#include "ModioModTag.generated.h" + + +USTRUCT(BlueprintType) +struct MODIO_API FModioModTag +{ + GENERATED_BODY() + + UPROPERTY(BlueprintReadOnly, Category = "ModTag") + FString Tag; +}; diff --git a/Source/Modio/Classes/Types/ModioModTagInfo.h b/Source/Modio/Public/Types/ModioModTagInfo.h similarity index 66% rename from Source/Modio/Classes/Types/ModioModTagInfo.h rename to Source/Modio/Public/Types/ModioModTagInfo.h index 2b4ee417..0f82a126 100644 --- a/Source/Modio/Classes/Types/ModioModTagInfo.h +++ b/Source/Modio/Public/Types/ModioModTagInfo.h @@ -1,16 +1,19 @@ -#pragma once +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once #include "Containers/Array.h" #include "Containers/UnrealString.h" -// clang-format off #include "ModioModTagInfo.generated.h" -// clang-format on - -namespace Modio -{ - struct ModTagInfo; -} /** @brief Metadata about a group of tags that can be used for filtering mods */ USTRUCT(BlueprintType) @@ -18,9 +21,6 @@ struct MODIO_API FModioModTagInfo { GENERATED_BODY() - FModioModTagInfo() = default; - FModioModTagInfo(const Modio::ModTagInfo& ModTagOptions); - /** @brief The display name for the tag */ UPROPERTY(BlueprintReadOnly,Category="mod.io|ModTagInfo") FString TagGroupName; @@ -34,9 +34,3 @@ struct MODIO_API FModioModTagInfo bool bAllowMultipleSelection; }; -#pragma region ToUnreal implementation -FORCEINLINE FModioModTagInfo ToUnreal(const Modio::ModTagInfo& ModTagInfo) -{ - return FModioModTagInfo(ModTagInfo); -} -#pragma endregion diff --git a/Source/Modio/Classes/Types/ModioModTagOptions.h b/Source/Modio/Public/Types/ModioModTagOptions.h similarity index 65% rename from Source/Modio/Classes/Types/ModioModTagOptions.h rename to Source/Modio/Public/Types/ModioModTagOptions.h index 42a5733b..3792f7cd 100644 --- a/Source/Modio/Classes/Types/ModioModTagOptions.h +++ b/Source/Modio/Public/Types/ModioModTagOptions.h @@ -1,12 +1,20 @@ -#pragma once - -#include "ModioSDK.h" -#include "Types/ModioModInfoList.h" +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once + +#include "Types/ModioList.h" #include "Types/ModioModTagInfo.h" +#include "Types/ModioPagedResult.h" -// clang-format off #include "ModioModTagOptions.generated.h" -// clang-format on #if CPP // Native version of FModioModTagOptions @@ -17,7 +25,8 @@ struct MODIO_API FModioModTagOptions : public FModioPagedResult, public FModioLi }; #else -// Blueprint mirror of FModioModTagOptions that's flattened as blueprints don't understand either template classes or multiple inheritance +// Blueprint mirror of FModioModTagOptions that's flattened as blueprints don't understand either template classes or +// multiple inheritance USTRUCT(NoExport, BlueprintType) struct MODIO_API FModioModTagOptions { @@ -40,10 +49,3 @@ struct FModioOptionalModTagOptions TOptional Internal; }; - -#pragma region ToUnreal implementation -FORCEINLINE FModioModTagOptions ToUnreal(const Modio::ModTagOptions& ModTagOptions) -{ - return FModioModTagOptions(ModTagOptions); -} -#pragma endregion diff --git a/Source/Modio/Public/Types/ModioPagedResult.h b/Source/Modio/Public/Types/ModioPagedResult.h new file mode 100644 index 00000000..434eed88 --- /dev/null +++ b/Source/Modio/Public/Types/ModioPagedResult.h @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once + +#include "ModioPagedResult.generated.h" + +namespace Modio +{ + class PagedResult; +} + +/** Base class for all api endpoints that can return paged results */ +USTRUCT(BlueprintType) +struct MODIO_API FModioPagedResult +{ + GENERATED_BODY() + + FModioPagedResult() = default; + FModioPagedResult(const Modio::PagedResult& Other); + FModioPagedResult(int32 ResultOffset, int32 PageSize, int32 TotalResultCount, int32 ResultCount); + + int32 GetPageIndex() const + { + return PageIndex; + } + int32 GetPageSize() const + { + return PageSize; + } + + int32 GetTotalResultCount() const + { + return TotalResultCount; + } + + int32 GetResultCount() const + { + return ResultCount; + } + +protected: + UPROPERTY(BlueprintReadOnly, Category = "mod.io|PagedResult|Page") + int32 PageIndex; + + UPROPERTY(BlueprintReadOnly, Category = "mod.io|PagedResult|Page") + int32 PageSize; + + UPROPERTY(BlueprintReadOnly, Category = "mod.io|PagedResult|Page") + int32 PageCount; + + UPROPERTY(BlueprintReadOnly, Category = "mod.io|PagedResult") + int32 TotalResultCount; + + UPROPERTY(BlueprintReadOnly, Category = "mod.io|PagedResult") + int32 ResultCount; +}; diff --git a/Source/Modio/Public/Types/ModioRating.h b/Source/Modio/Public/Types/ModioRating.h new file mode 100644 index 00000000..cf9c3f13 --- /dev/null +++ b/Source/Modio/Public/Types/ModioRating.h @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once + +#include "ModioRating.generated.h" + +UENUM() +enum class EModioRating : uint8 +{ + Neutral, + Positive, + Negative +}; \ No newline at end of file diff --git a/Source/Modio/Public/Types/ModioReportParams.h b/Source/Modio/Public/Types/ModioReportParams.h new file mode 100644 index 00000000..a9b3b776 --- /dev/null +++ b/Source/Modio/Public/Types/ModioReportParams.h @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once + +#include "ModioReportParams.generated.h" + +namespace Modio +{ + class ReportParams; +} + + +UENUM() +enum class EModioReportType : uint8 +{ + Generic = 0, + DMCA = 1, + NotWorking = 2, + RudeContent = 3, + IllegalContent = 4, + StolenContent = 5, + FalseInformation = 6, + Other = 7 +}; + + +USTRUCT(BlueprintType) +struct MODIO_API FModioReportParams +{ + GENERATED_BODY(); + + + FModioReportParams(); + + /// @brief Creates a content report for a game. + /// @param Game The ID of the game being reported + /// @param Type The nature of the content report + /// @param ReportDescription A description of why the content is being reported + /// @param ReporterName Name of the submitting user. Recommended for DMCA reports, but may be empty + /// @param ReporterContact Contact details of the submitting user. Recommended for DMCA reports, but may be + /// empty + FModioReportParams(struct FModioGameID Game, EModioReportType Type, FString ReportDescription, + TOptional ReporterName, TOptional ReporterContact); + + /// @docpublic + /// @brief Creates a content report for a game. + /// @param User The ID of the User being reported + /// @param Type The nature of the content report + /// @param ReportDescription A description of why the content is being reported + /// @param ReporterName Name of the submitting user. Recommended for DMCA reports, but may be empty + /// @param ReporterContact Contact details of the submitting user. Recommended for DMCA reports, but may be + /// empty + FModioReportParams(struct FModioUserID User, EModioReportType Type, FString ReportDescription, + TOptional ReporterName, TOptional ReporterContact); + + /// @docpublic + /// @brief Creates a content report for a game. + /// @param Mod The ID of the content being reported + /// @param Type The nature of the content report + /// @param ReportDescription A description of why the content is being reported + /// @param ReporterName Name of the submitting user. Recommended for DMCA reports, but may be empty + /// @param ReporterContact Contact details of the submitting user. Recommended for DMCA reports, but may be + /// empty + FModioReportParams(struct FModioModID Mod, EModioReportType Type, FString ReportDescription, + TOptional ReporterName, TOptional ReporterContact); + +private: + + + enum class ResourceType : uint8 + { + Game, + Mod, + User + }; + ResourceType ReportedResourceType; + + int64 ResourceID; + + EModioReportType Type; + + TOptional ReporterName; + + TOptional ReporterContact; + + FString ReportDescription; + + FModioReportParams(int64 ResourceID, ResourceType ReportedResourceType, EModioReportType Type, + FString ReportDescription, TOptional ReporterName, + TOptional ReporterContact); + + friend Modio::ReportParams ToModio(const FModioReportParams& In); +}; \ No newline at end of file diff --git a/Source/Modio/Classes/Types/ModioTerms.h b/Source/Modio/Public/Types/ModioTerms.h similarity index 73% rename from Source/Modio/Classes/Types/ModioTerms.h rename to Source/Modio/Public/Types/ModioTerms.h index f1e33e27..637c18dd 100644 --- a/Source/Modio/Classes/Types/ModioTerms.h +++ b/Source/Modio/Public/Types/ModioTerms.h @@ -1,6 +1,15 @@ -#pragma once +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once -#include "ModioSDK.h" #include "Containers/UnrealString.h" #include "ModioTerms.generated.h" @@ -9,10 +18,6 @@ USTRUCT(BlueprintType) struct MODIO_API FModioLink { GENERATED_BODY() - - FModioLink() = default; - FModioLink(const Modio::Terms::Link& Link); - FModioLink(const FModioLink& Link) = default; /** @brief The user-facing text for the link */ UPROPERTY(BlueprintReadOnly,Category="Terms|Link") @@ -33,10 +38,6 @@ USTRUCT(BlueprintType) struct MODIO_API FModioTerms { GENERATED_BODY(); - - FModioTerms() = default; - FModioTerms(const Modio::Terms& Terms); - FModioTerms(const FModioTerms& Terms) = default; /** @brief Text to display on the affirmative/OK button */ UPROPERTY(BlueprintReadOnly,Category="Terms|Buttons") @@ -73,21 +74,5 @@ struct FModioOptionalTerms { GENERATED_BODY() - FModioOptionalTerms() = default; - FModioOptionalTerms(TOptional&& ModTagOptions); - TOptional Internal; }; - -#pragma region ToUnreal implementation -FORCEINLINE FModioTerms ToUnreal(const Modio::Terms& Terms) -{ - return FModioTerms(Terms); -} - -FORCEINLINE FModioLink ToUnreal(const Modio::Terms::Link& Link) -{ - return FModioLink(Link); -} - -#pragma endregion \ No newline at end of file diff --git a/Source/Modio/Classes/Types/ModioURLList.h b/Source/Modio/Public/Types/ModioURLList.h similarity index 68% rename from Source/Modio/Classes/Types/ModioURLList.h rename to Source/Modio/Public/Types/ModioURLList.h index 43d82081..223710e5 100644 --- a/Source/Modio/Classes/Types/ModioURLList.h +++ b/Source/Modio/Public/Types/ModioURLList.h @@ -1,13 +1,26 @@ -#pragma once +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once #include "Containers/Array.h" #include "Containers/UnrealString.h" -#include "ModioSDK.h" #include "Types/ModioList.h" -// clang-format off #include "ModioURLList.generated.h" -// clang-format on + +namespace Modio +{ + class YoutubeURLList; + class SketchfabURLList; +} #if CPP struct MODIO_API FModioYoutubeURLList : public FModioList @@ -40,15 +53,3 @@ struct FModioSketchfabURLList FModioURLListInternal InternalList; }; #endif - -#pragma region ToUnreal implementation -FORCEINLINE FModioYoutubeURLList ToUnreal(const Modio::YoutubeURLList& UrlList) -{ - return FModioYoutubeURLList(UrlList); -} - -FORCEINLINE FModioSketchfabURLList ToUnreal(const Modio::SketchfabURLList& UrlList) -{ - return FModioSketchfabURLList(UrlList); -} -#pragma endregion \ No newline at end of file diff --git a/Source/Modio/Classes/Types/ModioUser.h b/Source/Modio/Public/Types/ModioUser.h similarity index 75% rename from Source/Modio/Classes/Types/ModioUser.h rename to Source/Modio/Public/Types/ModioUser.h index 2dc7a5eb..fe71e22a 100644 --- a/Source/Modio/Classes/Types/ModioUser.h +++ b/Source/Modio/Public/Types/ModioUser.h @@ -1,4 +1,14 @@ -#pragma once +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once #include "Types/ModioCommonTypes.h" @@ -42,15 +52,5 @@ struct MODIO_API FModioOptionalUser { GENERATED_BODY() - FModioOptionalUser() = default; - FModioOptionalUser(TOptional&& ModInfoList); - TOptional Internal; -}; - -#pragma region ToUnreal implementation -FORCEINLINE FModioUser ToUnreal(const Modio::User& Value) -{ - return FModioUser(Value); -} -#pragma endregion +}; \ No newline at end of file diff --git a/Source/Modio/Classes/Types/ModioValidationError.h b/Source/Modio/Public/Types/ModioValidationError.h similarity index 68% rename from Source/Modio/Classes/Types/ModioValidationError.h rename to Source/Modio/Public/Types/ModioValidationError.h index 23788881..1d142f9c 100644 --- a/Source/Modio/Classes/Types/ModioValidationError.h +++ b/Source/Modio/Public/Types/ModioValidationError.h @@ -1,3 +1,13 @@ +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + #pragma once #include "Internal/ModioConvert.h" #include "Containers/UnrealString.h" diff --git a/Source/Modio/Public/UI/ModioExampleLibrary.h b/Source/Modio/Public/UI/ModioExampleLibrary.h index c5c4b1e2..b8055091 100644 --- a/Source/Modio/Public/UI/ModioExampleLibrary.h +++ b/Source/Modio/Public/UI/ModioExampleLibrary.h @@ -1,4 +1,14 @@ -#pragma once +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once #include "Kismet/BlueprintFunctionLibrary.h" #include "ModioSubsystem.h" diff --git a/Source/Modio/Public/UI/ModioPopupBase.h b/Source/Modio/Public/UI/ModioPopupBase.h index e8aef02c..839fc84d 100644 --- a/Source/Modio/Public/UI/ModioPopupBase.h +++ b/Source/Modio/Public/UI/ModioPopupBase.h @@ -1,4 +1,14 @@ -#pragma once +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once #include "Blueprint/UserWidget.h" // clang-format off diff --git a/Source/Modio/Public/UI/ModioPopupContainer.h b/Source/Modio/Public/UI/ModioPopupContainer.h index 043cca37..13c3c31c 100644 --- a/Source/Modio/Public/UI/ModioPopupContainer.h +++ b/Source/Modio/Public/UI/ModioPopupContainer.h @@ -1,4 +1,14 @@ -#pragma once +/* + * Copyright (C) 2021 mod.io Pty Ltd. + * + * This file is part of the mod.io UE4 Plugin. + * + * Distributed under the MIT License. (See accompanying file LICENSE or + * view online at ) + * + */ + +#pragma once #include "Blueprint/UserWidget.h" // clang-format off diff --git a/Source/ThirdParty/NativeSDK b/Source/ThirdParty/NativeSDK index e21fb1d9..ffd57991 160000 --- a/Source/ThirdParty/NativeSDK +++ b/Source/ThirdParty/NativeSDK @@ -1 +1 @@ -Subproject commit e21fb1d98861a8e4eb7c17fbe012c2f07376447d +Subproject commit ffd579911c3cb42b3fc8e73f68f5bdccc28a4e5e

    Largest