Skip to content
This repository has been archived by the owner on Jun 22, 2023. It is now read-only.

Commit

Permalink
Release 1.0.0.2002 (#58)
Browse files Browse the repository at this point in the history
- Updated GraphQL templates
- Added `GetAssetsFromProjects` query to project schema
- Added `GetBalancesFromProjects` query to shared schema
  • Loading branch information
BishopJohnson committed Apr 11, 2023
1 parent 69483ac commit 6671723
Show file tree
Hide file tree
Showing 23 changed files with 701 additions and 10 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/Build & Test Linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install Conan
uses: turtlebrowser/get-conan@main
with:
version: 1.59.0

- name: Cache Conan Packages
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.conan/data
key: ${{ runner.os }}-conan-${{ hashFiles('**/.conan') }}
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/Build & Test Windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ jobs:
runs-on: windows-2019
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install Conan
uses: turtlebrowser/get-conan@main
with:
version: 1.59.0

- name: Cache Conan Packages
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.conan/data
key: ${{ runner.os }}-conan-${{ hashFiles('**/.conan') }}
Expand Down
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

## [1.0.0.2002] - 2023-04-11

- Added `GetAssetsFromProjects` to `IProjectSchema`.
- Added `GetBalancesFromProjects` to `ISharedSchema`.

## [1.0.0.2001] - 2023-01-02

### Added
Expand Down Expand Up @@ -169,7 +174,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

- Initial alpha release.

[Unreleased]: https://github.com/enjin/enjin-cpp-sdk/compare/1.0.0.2001...HEAD
[Unreleased]: https://github.com/enjin/enjin-cpp-sdk/compare/1.0.0.2002...HEAD

[1.0.0.2002]: https://github.com/enjin/enjin-cpp-sdk/compare/1.0.0.2001...1.0.0.2002

[1.0.0.2001]: https://github.com/enjin/enjin-cpp-sdk/compare/1.0.0.2000...1.0.0.2001

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ include(GenerateExportHeader)
### Define project and set properties
project(enjinsdk
LANGUAGES CXX
VERSION 1.0.0.2001)
VERSION 1.0.0.2002)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
Expand Down
2 changes: 1 addition & 1 deletion DOXYFILE
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "Enjin C++ SDK"
PROJECT_NUMBER = 1.0.0.2001
PROJECT_NUMBER = 1.0.0.2002
PROJECT_BRIEF = "A C++ SDK for creating games using the Enjin blockchain platform."
PROJECT_LOGO = doxygenIcon.png
OUTPUT_DIRECTORY =
Expand Down
126 changes: 126 additions & 0 deletions include/enjinsdk/project/GetAssetsFromProjects.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
/* Copyright 2023 Enjin Pte. Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef ENJINSDK_PROJECTGETASSETSFROMPROJECTS_HPP
#define ENJINSDK_PROJECTGETASSETSFROMPROJECTS_HPP

#include "enjinsdk_export.h"
#include "enjinsdk/internal/AbstractGraphqlRequest.hpp"
#include "enjinsdk/models/AssetFilter.hpp"
#include "enjinsdk/models/AssetSortInput.hpp"
#include "enjinsdk/shared/AssetFragmentArguments.hpp"
#include "enjinsdk/shared/PaginationArguments.hpp"
#include <optional>
#include <string>
#include <vector>

namespace enjin::sdk::project {

/// \brief Request for getting assets from different projects on the platform.
class ENJINSDK_EXPORT GetAssetsFromProjects : public graphql::AbstractGraphqlRequest,
public shared::AssetFragmentArguments<GetAssetsFromProjects>,
public shared::PaginationArguments<GetAssetsFromProjects> {
public:
/// \brief Default constructor.
GetAssetsFromProjects();

~GetAssetsFromProjects() override = default;

[[nodiscard]] std::string serialize() const override;

/// \brief Sets the project UUIDs.
/// \param projects The UUIDs.
/// \return This request for chaining.
GetAssetsFromProjects& set_projects(std::vector<std::string> projects);

/// \brief Sets the filter the request will use.
/// \param filter The filter.
/// \return This request for chaining.
GetAssetsFromProjects& set_filter(models::AssetFilter filter);

/// \brief Sets the request to sort the results by the specified options.
/// \param sort The sort input.
/// \return This request for chaining.
GetAssetsFromProjects& set_sort(models::AssetSortInput sort);

[[nodiscard]] json::JsonValue to_json() const override;

bool operator==(const GetAssetsFromProjects& rhs) const;

bool operator!=(const GetAssetsFromProjects& rhs) const;

private:
std::optional<std::vector<std::string>> projects_opt;
std::optional<models::AssetFilter> filter_opt;
std::optional<models::AssetSortInput> sort_opt;
};

}

namespace enjin::sdk::shared {

// region AssetFragmentArguments

template ENJINSDK_EXPORT project::GetAssetsFromProjects&
AssetFragmentArguments<project::GetAssetsFromProjects>::set_asset_id_format(models::AssetIdFormat asset_id_format);

template ENJINSDK_EXPORT project::GetAssetsFromProjects&
AssetFragmentArguments<project::GetAssetsFromProjects>::set_with_state_data();

template ENJINSDK_EXPORT project::GetAssetsFromProjects&
AssetFragmentArguments<project::GetAssetsFromProjects>::set_with_config_data();

template ENJINSDK_EXPORT project::GetAssetsFromProjects&
AssetFragmentArguments<project::GetAssetsFromProjects>::set_with_asset_blocks();

template ENJINSDK_EXPORT project::GetAssetsFromProjects&
AssetFragmentArguments<project::GetAssetsFromProjects>::set_with_creator();

template ENJINSDK_EXPORT project::GetAssetsFromProjects&
AssetFragmentArguments<project::GetAssetsFromProjects>::set_with_melt_details();

template ENJINSDK_EXPORT project::GetAssetsFromProjects&
AssetFragmentArguments<project::GetAssetsFromProjects>::set_with_metadata_uri();

template ENJINSDK_EXPORT project::GetAssetsFromProjects&
AssetFragmentArguments<project::GetAssetsFromProjects>::set_with_supply_details();

template ENJINSDK_EXPORT project::GetAssetsFromProjects&
AssetFragmentArguments<project::GetAssetsFromProjects>::set_with_transfer_settings();

template ENJINSDK_EXPORT project::GetAssetsFromProjects&
AssetFragmentArguments<project::GetAssetsFromProjects>::set_with_asset_variant_mode();

template ENJINSDK_EXPORT project::GetAssetsFromProjects&
AssetFragmentArguments<project::GetAssetsFromProjects>::set_with_asset_variants();

template ENJINSDK_EXPORT project::GetAssetsFromProjects&
AssetFragmentArguments<project::GetAssetsFromProjects>::set_with_variant_metadata();

// endregion AssetFragmentArguments

// region PaginationArguments

template ENJINSDK_EXPORT project::GetAssetsFromProjects&
PaginationArguments<project::GetAssetsFromProjects>::set_pagination(models::PaginationInput pagination);

template ENJINSDK_EXPORT project::GetAssetsFromProjects&
PaginationArguments<project::GetAssetsFromProjects>::set_pagination(int page, int limit);

// endregion PaginationArguments

}

#endif //ENJINSDK_PROJECTGETASSETSFROMPROJECTS_HPP
8 changes: 8 additions & 0 deletions include/enjinsdk/project/IProjectSchema.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "enjinsdk_export.h"
#include "enjinsdk/GraphqlResponse.hpp"
#include "enjinsdk/models/AccessToken.hpp"
#include "enjinsdk/models/Asset.hpp"
#include "enjinsdk/models/Player.hpp"
#include "enjinsdk/models/Transaction.hpp"
#include "enjinsdk/models/Wallet.hpp"
Expand All @@ -37,6 +38,7 @@
#include "enjinsdk/project/DecreaseMaxMeltFee.hpp"
#include "enjinsdk/project/DecreaseMaxTransferFee.hpp"
#include "enjinsdk/project/DeletePlayer.hpp"
#include "enjinsdk/project/GetAssetsFromProjects.hpp"
#include "enjinsdk/project/GetPlayer.hpp"
#include "enjinsdk/project/GetPlayers.hpp"
#include "enjinsdk/project/GetWallet.hpp"
Expand Down Expand Up @@ -145,6 +147,12 @@ class ENJINSDK_EXPORT IProjectSchema {
/// \return The future containing the response.
virtual std::future<graphql::GraphqlResponse<bool>> delete_player(DeletePlayer request) = 0;

/// \brief Sends the GetAssetsFromProjects request to the platform.
/// \param request The request.
/// \return The future containing the response.
virtual std::future<graphql::GraphqlResponse<std::vector<models::Asset>>>
get_assets_from_projects(GetAssetsFromProjects request) = 0;

/// \brief Sends the GetPlayer request to the platform.
/// \param request The request.
/// \return The future containing the response.
Expand Down
3 changes: 3 additions & 0 deletions include/enjinsdk/project/ProjectSchema.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ class ENJINSDK_EXPORT ProjectSchema : public IProjectSchema,

std::future<graphql::GraphqlResponse<bool>> delete_player(DeletePlayer request) override;

std::future<graphql::GraphqlResponse<std::vector<models::Asset>>>
get_assets_from_projects(GetAssetsFromProjects request) override;

std::future<graphql::GraphqlResponse<models::Player>> get_player(GetPlayer request) override;

std::future<graphql::GraphqlResponse<std::vector<models::Player>>> get_players(GetPlayers request) override;
Expand Down
92 changes: 92 additions & 0 deletions include/enjinsdk/shared/GetBalancesFromProjects.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/* Copyright 2023 Enjin Pte. Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef ENJINSDK_GETBALANCESFROMPROJECTS_HPP
#define ENJINSDK_GETBALANCESFROMPROJECTS_HPP

#include "enjinsdk_export.h"
#include "enjinsdk/internal/AbstractGraphqlRequest.hpp"
#include "enjinsdk/models/BalanceFilter.hpp"
#include "enjinsdk/shared/BalanceFragmentArguments.hpp"
#include "enjinsdk/shared/PaginationArguments.hpp"
#include <optional>
#include <string>
#include <vector>

namespace enjin::sdk::shared {

/// \brief Request for getting balances from different projects on the platform.
class ENJINSDK_EXPORT GetBalancesFromProjects : public graphql::AbstractGraphqlRequest,
public BalanceFragmentArguments<GetBalancesFromProjects>,
public PaginationArguments<GetBalancesFromProjects> {
public:
/// \brief Default constructor.
GetBalancesFromProjects();

/// \brief Class destructor.
~GetBalancesFromProjects() override = default;

[[nodiscard]] std::string serialize() const override;

/// \brief Sets the project UUIDs.
/// \param projects The UUIDs.
/// \return This request for chaining.
GetBalancesFromProjects& set_projects(std::vector<std::string> projects);

/// \brief Sets the filter the request will use.
/// \param filter The filter.
/// \return This request for chaining.
GetBalancesFromProjects& set_filter(models::BalanceFilter filter);

[[nodiscard]] json::JsonValue to_json() const override;

bool operator==(const GetBalancesFromProjects& rhs) const;

bool operator!=(const GetBalancesFromProjects& rhs) const;

private:
std::optional<std::vector<std::string>> projects_opt;
std::optional<models::BalanceFilter> filter_opt;
};

// region BalanceFragmentArguments

template ENJINSDK_EXPORT GetBalancesFromProjects&
BalanceFragmentArguments<GetBalancesFromProjects>::set_bal_id_format(models::AssetIdFormat bal_id_format);

template ENJINSDK_EXPORT GetBalancesFromProjects&
BalanceFragmentArguments<GetBalancesFromProjects>::set_bal_index_format(models::AssetIndexFormat bal_index_format);

template ENJINSDK_EXPORT GetBalancesFromProjects&
BalanceFragmentArguments<GetBalancesFromProjects>::set_with_bal_project_uuid();

template ENJINSDK_EXPORT GetBalancesFromProjects&
BalanceFragmentArguments<GetBalancesFromProjects>::set_with_bal_wallet_address();

// endregion BalanceFragmentArguments

// region PaginationArguments

template ENJINSDK_EXPORT GetBalancesFromProjects&
PaginationArguments<GetBalancesFromProjects>::set_pagination(models::PaginationInput pagination);

template ENJINSDK_EXPORT GetBalancesFromProjects&
PaginationArguments<GetBalancesFromProjects>::set_pagination(int page, int limit);

// endregion PaginationArguments

}

#endif //ENJINSDK_GETBALANCESFROMPROJECTS_HPP
10 changes: 9 additions & 1 deletion include/enjinsdk/shared/ISharedSchema.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "enjinsdk/models/Asset.hpp"
#include "enjinsdk/shared/CancelTransaction.hpp"
#include "enjinsdk/shared/GetBalances.hpp"
#include "enjinsdk/shared/GetBalancesFromProjects.hpp"
#include "enjinsdk/shared/GetGasPrices.hpp"
#include "enjinsdk/shared/GetPlatform.hpp"
#include "enjinsdk/shared/GetProject.hpp"
Expand Down Expand Up @@ -54,6 +55,12 @@ class ENJINSDK_EXPORT ISharedSchema {
/// \return The future containing the response.
virtual std::future<graphql::GraphqlResponse<std::vector<models::Balance>>> get_balances(GetBalances request) = 0;

/// \brief Sends the GetBalancesFromProjects request to the platform.
/// \param request The request.
/// \return The future containing the response.
virtual std::future<graphql::GraphqlResponse<std::vector<models::Balance>>>
get_balances_from_projects(GetBalancesFromProjects request) = 0;

/// \brief Sends the GetGasPrices request to the platform.
/// \param request The request.
/// \return The future containing the response.
Expand All @@ -77,7 +84,8 @@ class ENJINSDK_EXPORT ISharedSchema {
/// \brief Sends the GetRequests request to the platform.
/// \param request The request.
/// \return The future containing the response.
virtual std::future<graphql::GraphqlResponse<std::vector<models::Transaction>>> get_requests(GetTransactions request) = 0;
virtual std::future<graphql::GraphqlResponse<std::vector<models::Transaction>>>
get_requests(GetTransactions request) = 0;

/// \brief Sends the GetAsset request to the platform.
/// \param request The request.
Expand Down
6 changes: 5 additions & 1 deletion include/enjinsdk/shared/SharedSchema.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ class ENJINSDK_EXPORT SharedSchema : public ISharedSchema,

std::future<graphql::GraphqlResponse<std::vector<models::Balance>>> get_balances(GetBalances request) override;

std::future<graphql::GraphqlResponse<std::vector<models::Balance>>>
get_balances_from_projects(GetBalancesFromProjects request) override;

std::future<graphql::GraphqlResponse<models::GasPrices>> get_gas_prices(GetGasPrices request) override;

std::future<graphql::GraphqlResponse<models::Platform>> get_platform(GetPlatform request) override;
Expand All @@ -47,7 +50,8 @@ class ENJINSDK_EXPORT SharedSchema : public ISharedSchema,

std::future<graphql::GraphqlResponse<models::Transaction>> get_request(GetTransaction request) override;

std::future<graphql::GraphqlResponse<std::vector<models::Transaction>>> get_requests(GetTransactions request) override;
std::future<graphql::GraphqlResponse<std::vector<models::Transaction>>>
get_requests(GetTransactions request) override;

std::future<graphql::GraphqlResponse<models::Asset>> get_asset(GetAsset request) override;

Expand Down
Loading

0 comments on commit 6671723

Please sign in to comment.