Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address #630 #631

Merged
merged 3 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Description>Abstractions for GraphQL.Client</Description>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net7.0;net8.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
6 changes: 4 additions & 2 deletions src/GraphQL.Client.Abstractions/GraphQLClientExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System.Diagnostics.CodeAnalysis;

namespace GraphQL.Client.Abstractions;

public static class GraphQLClientExtensions
{
public static Task<GraphQLResponse<TResponse>> SendQueryAsync<TResponse>(this IGraphQLClient client,
string query, object? variables = null,
[StringSyntax("GraphQL")] string query, object? variables = null,
string? operationName = null, Func<TResponse> defineResponseType = null, CancellationToken cancellationToken = default)
{
_ = defineResponseType;
Expand All @@ -12,7 +14,7 @@ public static Task<GraphQLResponse<TResponse>> SendQueryAsync<TResponse>(this IG
}

public static Task<GraphQLResponse<TResponse>> SendMutationAsync<TResponse>(this IGraphQLClient client,
string query, object? variables = null,
[StringSyntax("GraphQL")] string query, object? variables = null,
string? operationName = null, Func<TResponse> defineResponseType = null, CancellationToken cancellationToken = default)
{
_ = defineResponseType;
Expand Down
2 changes: 1 addition & 1 deletion src/GraphQL.Primitives/GraphQL.Primitives.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<Description>GraphQL basic types</Description>
<RootNamespace>GraphQL</RootNamespace>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net7.0;net8.0</TargetFrameworks>
</PropertyGroup>

</Project>
5 changes: 4 additions & 1 deletion src/GraphQL.Primitives/GraphQLRequest.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System.Diagnostics.CodeAnalysis;

namespace GraphQL;

/// <summary>
Expand All @@ -13,6 +15,7 @@ public class GraphQLRequest : Dictionary<string, object>, IEquatable<GraphQLRequ
/// <summary>
/// The Query
/// </summary>
[StringSyntax("GraphQL")]
public string Query
{
get => TryGetValue(QUERY_KEY, out object value) ? (string)value : null;
Expand Down Expand Up @@ -48,7 +51,7 @@ public object? Variables

public GraphQLRequest() { }

public GraphQLRequest(string query, object? variables = null, string? operationName = null, Dictionary<string, object?>? extensions = null)
public GraphQLRequest([StringSyntax("GraphQL")] string query, object? variables = null, string? operationName = null, Dictionary<string, object?>? extensions = null)
{
Query = query;
Variables = variables;
Expand Down
17 changes: 17 additions & 0 deletions src/GraphQL.Primitives/StringSyntaxAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#if !NET7_0_OR_GREATER

namespace System.Diagnostics.CodeAnalysis;

/// <summary>
/// Stub
/// </summary>
public sealed class StringSyntaxAttribute : Attribute
{
public const string CompositeFormat = nameof(CompositeFormat);

public StringSyntaxAttribute(string syntax)
{
}

}
#endif
Loading