diff --git a/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk.Tests/Enjin.Platform.Sdk.Tests.csproj b/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk.Tests/Enjin.Platform.Sdk.Tests.csproj index bad50b5..afec526 100644 --- a/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk.Tests/Enjin.Platform.Sdk.Tests.csproj +++ b/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk.Tests/Enjin.Platform.Sdk.Tests.csproj @@ -6,7 +6,7 @@ false - 3.0.0 + 3.0.1 diff --git a/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Enjin.Platform.Sdk.csproj b/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Enjin.Platform.Sdk.csproj index a7b4344..39921ee 100644 --- a/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Enjin.Platform.Sdk.csproj +++ b/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Enjin.Platform.Sdk.csproj @@ -5,7 +5,7 @@ Open source SDK for connecting to and interacting with the Enjin Platform. Enjin Pte. Ltd. Enjin Pte. Ltd. - 3.0.0 + 3.0.1 netstandard2.1 12 Enjin.Platform.Sdk diff --git a/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/Infrastructure/GraphQlTypes.cs b/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/Infrastructure/GraphQlTypes.cs index bf1a016..a455ba3 100644 --- a/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/Infrastructure/GraphQlTypes.cs +++ b/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/Infrastructure/GraphQlTypes.cs @@ -33,6 +33,7 @@ public static class GraphQlTypes public const string Account = "Account"; public const string AccountPool = "AccountPool"; + public const string AccountToken = "AccountToken"; public const string Attribute = "Attribute"; public const string Block = "Block"; public const string Collection = "Collection"; diff --git a/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/Model/Account.cs b/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/Model/Account.cs index 8cdcae6..2ac4eff 100644 --- a/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/Model/Account.cs +++ b/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/Model/Account.cs @@ -34,8 +34,8 @@ public partial class Account /// public global::System.Numerics.BigInteger Balance { get; set; } /// - /// The tokens held by this account. + /// The tokens held by this account, each paired with the account's balance. /// - public ICollection? Tokens { get; set; } + public ICollection? Tokens { get; set; } } diff --git a/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/Model/AccountToken.cs b/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/Model/AccountToken.cs new file mode 100644 index 0000000..b676b77 --- /dev/null +++ b/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/Model/AccountToken.cs @@ -0,0 +1,29 @@ +// This file has been auto generated. +#nullable enable annotations + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Globalization; +using System.Runtime.Serialization; +#if !GRAPHQL_GENERATOR_DISABLE_NEWTONSOFT_JSON +using Newtonsoft.Json; +#endif + +namespace Enjin.Platform.Sdk; + +/// +/// A token held by an account, paired with the account's balance for that token. +/// +public partial class AccountToken +{ + /// + /// The account's balance of this token. + /// + public global::System.Numerics.BigInteger Balance { get; set; } + /// + /// The token itself. + /// + public Token? Token { get; set; } +} + diff --git a/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/Model/Collection.cs b/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/Model/Collection.cs index ba678f8..229eb61 100644 --- a/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/Model/Collection.cs +++ b/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/Model/Collection.cs @@ -54,7 +54,7 @@ public partial class Collection /// public ICollection? TokenGroups { get; set; } /// - /// The holders of tokens in this collection. Only populated when fetching a single collection via GetCollection. + /// The holders of tokens in this collection. The effective per-page limit depends on context: up to 100 when fetched via GetCollection (detail), up to 10 when fetched via GetCollections (bulk). /// public ICollection? Holders { get; set; } } diff --git a/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/Model/Token.cs b/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/Model/Token.cs index f791ca7..dd3410c 100644 --- a/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/Model/Token.cs +++ b/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/Model/Token.cs @@ -74,7 +74,7 @@ public partial class Token /// public Collection? Collection { get; set; } /// - /// The holders of this token with their balances. Only populated when querying via GetToken directly. + /// The holders of this token with their balances. The effective per-page limit depends on context: up to 100 when fetched via GetToken (detail), up to 10 when fetched via GetTokens or GetAccount.tokens (bulk). /// public ICollection? Holders { get; set; } } diff --git a/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/QueryBuilders/AccountQueryBuilder.cs b/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/QueryBuilders/AccountQueryBuilder.cs index fd0fdc1..6e3b6c7 100644 --- a/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/QueryBuilders/AccountQueryBuilder.cs +++ b/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/QueryBuilders/AccountQueryBuilder.cs @@ -20,7 +20,7 @@ public partial class AccountQueryBuilder : GraphQlQueryBuilder "Account"; @@ -47,7 +47,8 @@ public partial class AccountQueryBuilder : GraphQlQueryBuilderThe offset for pagination. /// Filter tokens by collection ID. /// Filter by token IDs within the collection (requires collectionId). - public AccountQueryBuilder WithTokens(TokenQueryBuilder tokenQueryBuilder, QueryBuilderParameter limit, QueryBuilderParameter? after = null, QueryBuilderParameter? collectionId = null, QueryBuilderParameter>? tokenIds = null, string? alias = null, IncludeDirective? include = null, SkipDirective? skip = null) + /// Filter tokens to only those belonging to this token group ID. + public AccountQueryBuilder WithTokens(AccountTokenQueryBuilder accountTokenQueryBuilder, QueryBuilderParameter limit, QueryBuilderParameter? after = null, QueryBuilderParameter? collectionId = null, QueryBuilderParameter>? tokenIds = null, QueryBuilderParameter? tokenGroupId = null, string? alias = null, IncludeDirective? include = null, SkipDirective? skip = null) { var args = new List(); args.Add(new() { ArgumentName = "limit", ArgumentValue = limit} ); @@ -60,7 +61,10 @@ public AccountQueryBuilder WithTokens(TokenQueryBuilder tokenQueryBuilder, Query if (tokenIds != null) args.Add(new() { ArgumentName = "tokenIds", ArgumentValue = tokenIds} ); - return WithObjectField("tokens", alias, tokenQueryBuilder, [include, skip], args); + if (tokenGroupId != null) + args.Add(new() { ArgumentName = "tokenGroupId", ArgumentValue = tokenGroupId} ); + + return WithObjectField("tokens", alias, accountTokenQueryBuilder, [include, skip], args); } public AccountQueryBuilder ExceptTokens() => ExceptField("tokens"); diff --git a/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/QueryBuilders/AccountTokenQueryBuilder.cs b/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/QueryBuilders/AccountTokenQueryBuilder.cs new file mode 100644 index 0000000..a9da479 --- /dev/null +++ b/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/QueryBuilders/AccountTokenQueryBuilder.cs @@ -0,0 +1,35 @@ +// This file has been auto generated. +#nullable enable annotations + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Globalization; +using System.Runtime.Serialization; +#if !GRAPHQL_GENERATOR_DISABLE_NEWTONSOFT_JSON +using Newtonsoft.Json; +#endif + +namespace Enjin.Platform.Sdk; + +public partial class AccountTokenQueryBuilder : GraphQlQueryBuilder +{ + private static readonly GraphQlFieldMetadata[] AllFieldMetadata = + { + new() { Name = "balance" }, + new() { Name = "token", IsComplex = true, QueryBuilderType = typeof(TokenQueryBuilder) } + }; + + protected override string TypeName => "AccountToken"; + + public override IReadOnlyList AllFields => AllFieldMetadata; + + public AccountTokenQueryBuilder WithBalance(string? alias = null, IncludeDirective? include = null, SkipDirective? skip = null) => WithScalarField("balance", alias, [include, skip]); + + public AccountTokenQueryBuilder ExceptBalance() => ExceptField("balance"); + + public AccountTokenQueryBuilder WithToken(TokenQueryBuilder tokenQueryBuilder, string? alias = null, IncludeDirective? include = null, SkipDirective? skip = null) => WithObjectField("token", alias, tokenQueryBuilder, [include, skip]); + + public AccountTokenQueryBuilder ExceptToken() => ExceptField("token"); +} + diff --git a/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/QueryBuilders/CollectionQueryBuilder.cs b/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/QueryBuilders/CollectionQueryBuilder.cs index d1b4576..b0eb60c 100644 --- a/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/QueryBuilders/CollectionQueryBuilder.cs +++ b/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/QueryBuilders/CollectionQueryBuilder.cs @@ -68,12 +68,14 @@ public partial class CollectionQueryBuilder : GraphQlQueryBuilder ExceptField("tokenGroups"); - /// Number of holders to return per page (max 100, default 100). + /// Number of holders to return per page. Defaults to the context cap (100 in GetCollection, 10 in bulk queries). Requesting a limit above the context cap raises a validation error. /// Page number (max 500, default 1). - public CollectionQueryBuilder WithHolders(CollectionHolderQueryBuilder collectionHolderQueryBuilder, QueryBuilderParameter limit, QueryBuilderParameter page, string? alias = null, IncludeDirective? include = null, SkipDirective? skip = null) + public CollectionQueryBuilder WithHolders(CollectionHolderQueryBuilder collectionHolderQueryBuilder, QueryBuilderParameter page, QueryBuilderParameter? limit = null, string? alias = null, IncludeDirective? include = null, SkipDirective? skip = null) { var args = new List(); - args.Add(new() { ArgumentName = "limit", ArgumentValue = limit} ); + if (limit != null) + args.Add(new() { ArgumentName = "limit", ArgumentValue = limit} ); + args.Add(new() { ArgumentName = "page", ArgumentValue = page} ); return WithObjectField("holders", alias, collectionHolderQueryBuilder, [include, skip], args); } diff --git a/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/QueryBuilders/TokenQueryBuilder.cs b/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/QueryBuilders/TokenQueryBuilder.cs index 228193b..5fd3e8d 100644 --- a/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/QueryBuilders/TokenQueryBuilder.cs +++ b/src/Enjin.Platform.Sdk/Enjin.Platform.Sdk/Schema/QueryBuilders/TokenQueryBuilder.cs @@ -93,12 +93,14 @@ public partial class TokenQueryBuilder : GraphQlQueryBuilder public TokenQueryBuilder ExceptCollection() => ExceptField("collection"); - /// Number of holders to return per page (max 100, default 100). + /// Number of holders to return per page. Defaults to the context cap (100 in GetToken, 10 in bulk queries). Requesting a limit above the context cap raises a validation error. /// Page number (max 500, default 1). - public TokenQueryBuilder WithHolders(TokenHolderQueryBuilder tokenHolderQueryBuilder, QueryBuilderParameter limit, QueryBuilderParameter page, string? alias = null, IncludeDirective? include = null, SkipDirective? skip = null) + public TokenQueryBuilder WithHolders(TokenHolderQueryBuilder tokenHolderQueryBuilder, QueryBuilderParameter page, QueryBuilderParameter? limit = null, string? alias = null, IncludeDirective? include = null, SkipDirective? skip = null) { var args = new List(); - args.Add(new() { ArgumentName = "limit", ArgumentValue = limit} ); + if (limit != null) + args.Add(new() { ArgumentName = "limit", ArgumentValue = limit} ); + args.Add(new() { ArgumentName = "page", ArgumentValue = page} ); return WithObjectField("holders", alias, tokenHolderQueryBuilder, [include, skip], args); }