-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add APQ support * changes * rem * note * progress * progress * fix variable name * move APQ code to SendQueryAsync method to allow usage over websocket, too * make the APQDisabledForSession flag public (helps for testing) * create a test that uses the APQ feature * test APQ with websocket transport * move code for generation of the APQ extension into GraphQLRequest * fix naming * replace system.memory reference with narrower system.buffers reference * Update src/GraphQL.Primitives/GraphQLRequest.cs Co-authored-by: Shane Krueger <[email protected]> * Update src/GraphQL.Primitives/GraphQLRequest.cs Co-authored-by: Shane Krueger <[email protected]> * document APQ feature +semver: feature * optimize docs --------- Co-authored-by: Alexander Rose <[email protected]> Co-authored-by: Alexander Rose <[email protected]> Co-authored-by: Shane Krueger <[email protected]>
- Loading branch information
1 parent
dbd9c20
commit 6236c9b
Showing
13 changed files
with
315 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=APQ/@EntryIndexedValue">APQ</s:String> | ||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=QL/@EntryIndexedValue">QL</s:String></wpf:ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,34 @@ | ||
#if NET6_0_OR_GREATER | ||
using System.Diagnostics.CodeAnalysis; | ||
|
||
namespace GraphQL; | ||
|
||
/// <summary> | ||
/// Value record for a GraphQL query string | ||
/// Value object representing a GraphQL query string and storing the corresponding APQ hash. <br /> | ||
/// Use this to hold query strings you want to use more than once. | ||
/// </summary> | ||
/// <param name="Text">the actual query string</param> | ||
public readonly record struct GraphQLQuery([StringSyntax("GraphQL")] string Text) | ||
public class GraphQLQuery : IEquatable<GraphQLQuery> | ||
{ | ||
/// <summary> | ||
/// The actual query string | ||
/// </summary> | ||
public string Text { get; } | ||
|
||
/// <summary> | ||
/// The SHA256 hash used for the automatic persisted queries feature (APQ) | ||
/// </summary> | ||
public string Sha256Hash { get; } | ||
|
||
public GraphQLQuery([StringSyntax("GraphQL")] string text) | ||
{ | ||
Text = text; | ||
Sha256Hash = Hash.Compute(Text); | ||
} | ||
|
||
public static implicit operator string(GraphQLQuery query) | ||
=> query.Text; | ||
}; | ||
#endif | ||
|
||
public bool Equals(GraphQLQuery other) => Sha256Hash == other.Sha256Hash; | ||
|
||
public override bool Equals(object? obj) => obj is GraphQLQuery other && Equals(other); | ||
|
||
public override int GetHashCode() => Sha256Hash.GetHashCode(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.