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

[WIP] spell check, formatting, code cleanup #212

Merged
merged 11 commits into from
Apr 21, 2020
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
18 changes: 9 additions & 9 deletions examples/GraphQL.Client.Example/GraphQL.Client.Example.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\GraphQL.Client.Serializer.Newtonsoft\GraphQL.Client.Serializer.Newtonsoft.csproj" />
<ProjectReference Include="..\..\src\GraphQL.Client\GraphQL.Client.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\GraphQL.Client.Serializer.Newtonsoft\GraphQL.Client.Serializer.Newtonsoft.csproj" />
<ProjectReference Include="..\..\src\GraphQL.Client\GraphQL.Client.csproj" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions examples/GraphQL.Client.Example/PersonAndFilmsResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class PersonAndFilmsResponse
public class PersonContent
{
public string Name { get; set; }

public FilmConnectionContent FilmConnection { get; set; }

public class FilmConnectionContent
Expand Down
6 changes: 1 addition & 5 deletions examples/GraphQL.Client.Example/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@

namespace GraphQL.Client.Example
{

public class Program
{

public static async Task Main(string[] args)
public static async Task Main()
{
_ = args;
using var graphQLClient = new GraphQLHttpClient("https://swapi.apis.guru/", new NewtonsoftJsonSerializer());

var personAndFilmsRequest = new GraphQLRequest
Expand Down Expand Up @@ -49,6 +46,5 @@ query PersonAndFilms($id: ID) {
Console.WriteLine("Press any key to quit...");
Console.ReadKey();
}

}
}
67 changes: 33 additions & 34 deletions root.props
Original file line number Diff line number Diff line change
@@ -1,39 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>

<PropertyGroup>
<Authors>Deinok,Alexander Rose,graphql-dotnet</Authors>
<Description>A GraphQL Client for .NET Standard</Description>
<GenerateAssemblyInfo>True</GenerateAssemblyInfo>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<LangVersion>8.0</LangVersion>
<NeutralLanguage>en-US</NeutralLanguage>
<NoWarn>CS0618;CS1591;CS1701;CS8618;CS8632;NU5048;NU5105;NU5125</NoWarn>
<Nullable>annotations</Nullable>
<PackageIcon>icon.png</PackageIcon>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<PackageProjectUrl>https://github.com/graphql-dotnet/graphql-client</PackageProjectUrl>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageTags>GraphQL</PackageTags>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/graphql-dotnet/graphql-client</RepositoryUrl>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<Authors>Deinok,Alexander Rose,graphql-dotnet</Authors>
<Description>A GraphQL Client for .NET Standard</Description>
<GenerateAssemblyInfo>True</GenerateAssemblyInfo>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<LangVersion>8.0</LangVersion>
<NeutralLanguage>en-US</NeutralLanguage>
<NoWarn>$(NoWarn);CS1591;NU5048;NU5105;NU5125</NoWarn>
<Nullable>annotations</Nullable>
<PackageIcon>icon.png</PackageIcon>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<PackageProjectUrl>https://github.com/graphql-dotnet/graphql-client</PackageProjectUrl>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageTags>GraphQL</PackageTags>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/graphql-dotnet/graphql-client</RepositoryUrl>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
</PropertyGroup>

<ItemGroup>
<Content Include="$(MSBuildThisFileDirectory)/LICENSE.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>true</Pack>
<PackagePath>LICENSE.txt</PackagePath>
<Visible>false</Visible>
</Content>
<Content Include="$(MSBuildThisFileDirectory)/assets/logo.64x64.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>true</Pack>
<PackagePath>icon.png</PackagePath>
<Visible>false</Visible>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="$(MSBuildThisFileDirectory)/LICENSE.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>true</Pack>
<PackagePath>LICENSE.txt</PackagePath>
<Visible>false</Visible>
</Content>
<Content Include="$(MSBuildThisFileDirectory)/assets/logo.64x64.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>true</Pack>
<PackagePath>icon.png</PackagePath>
<Visible>false</Visible>
</Content>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../src.props" />

<Import Project="../src.props" />

<PropertyGroup>
<PropertyGroup>
<Description>Abstractions for the Websocket transport used in GraphQL.Client</Description>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\GraphQL.Client.Abstractions\GraphQL.Client.Abstractions.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GraphQL.Client.Abstractions\GraphQL.Client.Abstractions.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,5 @@ public static class GraphQLWebSocketMessageType
/// id: string : operation id
/// </summary>
public const string GQL_STOP = "stop"; // Client -> Server

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace GraphQL.Client.Abstractions.Websocket
{

/// <summary>
/// A Subscription Request
/// </summary>
Expand Down Expand Up @@ -50,7 +49,7 @@ public GraphQLRequest Payload
public Task SendTask() => _tcs.Task;

/// <summary>
/// gets called when the send operation for this request has completed sucessfully
/// gets called when the send operation for this request has completed successfully
/// </summary>
public void SendCompleted() => _tcs.SetResult(true);

Expand Down Expand Up @@ -109,7 +108,5 @@ public override int GetHashCode()

/// <inheritdoc />
public static bool operator !=(GraphQLWebSocketRequest request1, GraphQLWebSocketRequest request2) => !(request1 == request2);

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@

namespace GraphQL.Client.Abstractions.Websocket
{

/// <summary>
/// A Subscription Response
/// </summary>
public class GraphQLWebSocketResponse : IEquatable<GraphQLWebSocketResponse>
{

/// <summary>
/// The Identifier of the Response
/// </summary>
Expand Down Expand Up @@ -65,7 +63,6 @@ public override int GetHashCode()
/// <inheritdoc />
public static bool operator !=(GraphQLWebSocketResponse response1, GraphQLWebSocketResponse response2) =>
!(response1 == response2);

}

public class GraphQLWebSocketResponse<TPayload> : GraphQLWebSocketResponse, IEquatable<GraphQLWebSocketResponse<TPayload>>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ namespace GraphQL.Client.Abstractions.Websocket
public enum GraphQLWebsocketConnectionState
{
Disconnected,

Connecting,

Connected
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public interface IGraphQLWebsocketJsonSerializer : IGraphQLJsonSerializer
byte[] SerializeToBytes(GraphQLWebSocketRequest request);

Task<WebsocketMessageWrapper> DeserializeToWebsocketResponseWrapperAsync(Stream stream);
GraphQLWebSocketResponse<GraphQLResponse<TResponse>> DeserializeToWebsocketResponse<TResponse>(byte[] bytes);

GraphQLWebSocketResponse<GraphQLResponse<TResponse>> DeserializeToWebsocketResponse<TResponse>(byte[] bytes);
}
}
23 changes: 11 additions & 12 deletions src/GraphQL.Client.Abstractions/GraphQL.Client.Abstractions.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="../src.props" />
<Import Project="../src.props" />

<PropertyGroup>
<Description>Abstractions for GraphQL.Client</Description>
<RootNamespace>GraphQL.Client.Abstractions</RootNamespace>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
</PropertyGroup>
<PropertyGroup>
<Description>Abstractions for GraphQL.Client</Description>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\GraphQL.Primitives\GraphQL.Primitives.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GraphQL.Primitives\GraphQL.Primitives.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Reactive" Version="4.3.2" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Reactive" Version="4.3.2" />
</ItemGroup>

</Project>
5 changes: 1 addition & 4 deletions src/GraphQL.Client.Abstractions/IGraphQLClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@

namespace GraphQL.Client.Abstractions
{

public interface IGraphQLClient : IDisposable
{

Task<GraphQLResponse<TResponse>> SendQueryAsync<TResponse>(GraphQLRequest request, CancellationToken cancellationToken = default);

Task<GraphQLResponse<TResponse>> SendMutationAsync<TResponse>(GraphQLRequest request, CancellationToken cancellationToken = default);
Expand All @@ -30,9 +28,8 @@ public interface IGraphQLClient : IDisposable
/// Any exception thrown by <paramref name="exceptionHandler"/> will cause the sequence to fail.
/// </summary>
/// <param name="request">the GraphQL request for this subscription</param>
/// <param name="exceptionHandler">an external handler for all <see cref="Exception"/>s occuring within the sequence</param>
/// <param name="exceptionHandler">an external handler for all <see cref="Exception"/>s occurring within the sequence</param>
/// <returns>an observable stream for the specified subscription</returns>
IObservable<GraphQLResponse<TResponse>> CreateSubscriptionStream<TResponse>(GraphQLRequest request, Action<Exception> exceptionHandler);
}

}
5 changes: 1 addition & 4 deletions src/GraphQL.Client.Abstractions/IGraphQLJsonSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ public interface IGraphQLJsonSerializer
{
string SerializeToString(GraphQLRequest request);

Task<GraphQLResponse<TResponse>> DeserializeFromUtf8StreamAsync<TResponse>(Stream stream,
CancellationToken cancellationToken);
Task<GraphQLResponse<TResponse>> DeserializeFromUtf8StreamAsync<TResponse>(Stream stream, CancellationToken cancellationToken);
}


}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="../src.props" />
<Import Project="../src.props" />

<PropertyGroup>
<Description>A GraphQL Client which executes the queries directly on a provided GraphQL schema using graphql-dotnet</Description>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<Description>A GraphQL Client which executes the queries directly on a provided GraphQL schema using graphql-dotnet</Description>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="GraphQL" Version="2.4.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="System.Reactive.Compatibility" Version="4.3.2" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="GraphQL" Version="2.4.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="System.Reactive.Compatibility" Version="4.3.2" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\GraphQL.Client.Abstractions\GraphQL.Client.Abstractions.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GraphQL.Client.Abstractions\GraphQL.Client.Abstractions.csproj" />
</ItemGroup>

</Project>
1 change: 0 additions & 1 deletion src/GraphQL.Client.LocalExecution/GraphQLEnumConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,4 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ public static GraphQLLocalExecutionClient<TSchema> New<TSchema>(TSchema schema,
=> new GraphQLLocalExecutionClient<TSchema>(schema, serializer);
}


public class GraphQLLocalExecutionClient<TSchema> : IGraphQLClient where TSchema : ISchema
{

private static readonly JsonSerializerSettings _variablesSerializerSettings = new JsonSerializerSettings
{
Formatting = Formatting.Indented,
Expand All @@ -38,8 +36,8 @@ public class GraphQLLocalExecutionClient<TSchema> : IGraphQLClient where TSchema
};

public TSchema Schema { get; }
public IGraphQLJsonSerializer Serializer { get; }

public IGraphQLJsonSerializer Serializer { get; }

private readonly DocumentExecuter _documentExecuter;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../src.props" />

<Import Project="../src.props" />

<PropertyGroup>
<Description>A serializer implementation for GraphQL.Client using Newtonsoft.Json as underlying JSON library</Description>
Expand Down
Loading