Skip to content
Open
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
14 changes: 8 additions & 6 deletions BlazorChat/Client/BlazorChat.Client.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="5.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="5.0.4" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="5.0.4" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="6.0.0-preview.6.*" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.0-preview.6.*" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.0-preview.6.*" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="6.0.0-preview.6.*" />
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
<PackageReference Include="MudBlazor" Version="5.0.7" />
<PackageReference Include="SignalR.Strong.SourceGenerator" Version="0.3.1" />
<PackageReference Include="System.Net.Http.Json" Version="5.0.0" />
</ItemGroup>

Expand Down
888 changes: 888 additions & 0 deletions BlazorChat/Client/Generated/ChatClientGenerated.cs

Large diffs are not rendered by default.

101 changes: 101 additions & 0 deletions BlazorChat/Client/Generated/config.nswag
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"runtime": "Net50",
"defaultVariables": null,
"documentGenerator": {
"fromDocument": {
"json": "{\r\n \"x-generator\": \"NSwag v13.11.3.0 (NJsonSchema v10.4.4.0 (Newtonsoft.Json v12.0.0.0))\",\r\n \"swagger\": \"2.0\",\r\n \"info\": {\r\n \"title\": \"My Title\",\r\n \"version\": \"1.0.0\"\r\n },\r\n \"host\": \"localhost:5001\",\r\n \"schemes\": [\r\n \"https\"\r\n ],\r\n \"paths\": {\r\n \"/api/Chat/{contactId}\": {\r\n \"get\": {\r\n \"tags\": [\r\n \"Chat\"\r\n ],\r\n \"operationId\": \"Chat_GetConversation\",\r\n \"parameters\": [\r\n {\r\n \"type\": \"string\",\r\n \"name\": \"contactId\",\r\n \"in\": \"path\",\r\n \"required\": true,\r\n \"x-nullable\": true\r\n }\r\n ],\r\n \"responses\": {\r\n \"200\": {\r\n \"x-nullable\": true,\r\n \"description\": \"\",\r\n \"schema\": {\r\n \"type\": \"file\"\r\n }\r\n }\r\n }\r\n }\r\n },\r\n \"/api/Chat/users\": {\r\n \"get\": {\r\n \"tags\": [\r\n \"Chat\"\r\n ],\r\n \"operationId\": \"Chat_GetUsers\",\r\n \"responses\": {\r\n \"200\": {\r\n \"x-nullable\": true,\r\n \"description\": \"\",\r\n \"schema\": {\r\n \"type\": \"file\"\r\n }\r\n }\r\n }\r\n }\r\n },\r\n \"/api/Chat/users/{userId}\": {\r\n \"get\": {\r\n \"tags\": [\r\n \"Chat\"\r\n ],\r\n \"operationId\": \"Chat_GetUserDetails\",\r\n \"parameters\": [\r\n {\r\n \"type\": \"string\",\r\n \"name\": \"userId\",\r\n \"in\": \"path\",\r\n \"required\": true,\r\n \"x-nullable\": true\r\n }\r\n ],\r\n \"responses\": {\r\n \"200\": {\r\n \"x-nullable\": true,\r\n \"description\": \"\",\r\n \"schema\": {\r\n \"type\": \"file\"\r\n }\r\n }\r\n }\r\n }\r\n },\r\n \"/api/Chat/users/{userId}/status/{status}\": {\r\n \"patch\": {\r\n \"tags\": [\r\n \"Chat\"\r\n ],\r\n \"operationId\": \"Chat_UpdateConversationStatus\",\r\n \"parameters\": [\r\n {\r\n \"type\": \"string\",\r\n \"name\": \"userId\",\r\n \"in\": \"path\",\r\n \"required\": true,\r\n \"x-nullable\": true\r\n },\r\n {\r\n \"type\": \"integer\",\r\n \"name\": \"status\",\r\n \"in\": \"path\",\r\n \"required\": true,\r\n \"x-schema\": {\r\n \"$ref\": \"#/definitions/ChatStatus\"\r\n },\r\n \"x-nullable\": false,\r\n \"enum\": [\r\n 0,\r\n 1,\r\n 2\r\n ]\r\n }\r\n ],\r\n \"responses\": {\r\n \"200\": {\r\n \"x-nullable\": true,\r\n \"description\": \"\",\r\n \"schema\": {\r\n \"type\": \"file\"\r\n }\r\n }\r\n }\r\n }\r\n },\r\n \"/api/Chat/users/messages/{msgId}/status/{status}\": {\r\n \"patch\": {\r\n \"tags\": [\r\n \"Chat\"\r\n ],\r\n \"operationId\": \"Chat_UpdateMsgStatus\",\r\n \"produces\": [\r\n \"text/plain\",\r\n \"application/json\",\r\n \"text/json\"\r\n ],\r\n \"parameters\": [\r\n {\r\n \"type\": \"integer\",\r\n \"name\": \"msgId\",\r\n \"in\": \"path\",\r\n \"required\": true,\r\n \"format\": \"int64\",\r\n \"x-nullable\": false\r\n },\r\n {\r\n \"type\": \"integer\",\r\n \"name\": \"status\",\r\n \"in\": \"path\",\r\n \"required\": true,\r\n \"format\": \"int32\",\r\n \"x-nullable\": false\r\n }\r\n ],\r\n \"responses\": {\r\n \"200\": {\r\n \"x-nullable\": false,\r\n \"description\": \"\",\r\n \"schema\": {\r\n \"$ref\": \"#/definitions/ChatMessage\"\r\n }\r\n },\r\n \"400\": {\r\n \"x-nullable\": false,\r\n \"description\": \"\",\r\n \"schema\": {\r\n \"type\": \"string\"\r\n }\r\n }\r\n }\r\n }\r\n },\r\n \"/api/Chat\": {\r\n \"post\": {\r\n \"tags\": [\r\n \"Chat\"\r\n ],\r\n \"operationId\": \"Chat_SaveMessage\",\r\n \"consumes\": [\r\n \"application/json\",\r\n \"text/json\",\r\n \"application/*+json\"\r\n ],\r\n \"parameters\": [\r\n {\r\n \"name\": \"message\",\r\n \"in\": \"body\",\r\n \"required\": true,\r\n \"schema\": {\r\n \"$ref\": \"#/definitions/ChatMessage\"\r\n },\r\n \"x-nullable\": false\r\n }\r\n ],\r\n \"responses\": {\r\n \"200\": {\r\n \"x-nullable\": true,\r\n \"description\": \"\",\r\n \"schema\": {\r\n \"type\": \"file\"\r\n }\r\n }\r\n }\r\n }\r\n },\r\n \"/_configuration/{clientId}\": {\r\n \"get\": {\r\n \"tags\": [\r\n \"OidcConfiguration\"\r\n ],\r\n \"operationId\": \"OidcConfiguration_GetClientRequestParameters\",\r\n \"parameters\": [\r\n {\r\n \"type\": \"string\",\r\n \"name\": \"clientId\",\r\n \"in\": \"path\",\r\n \"required\": true,\r\n \"x-nullable\": true\r\n }\r\n ],\r\n \"responses\": {\r\n \"200\": {\r\n \"x-nullable\": true,\r\n \"description\": \"\",\r\n \"schema\": {\r\n \"type\": \"file\"\r\n }\r\n }\r\n }\r\n }\r\n },\r\n \"/WeatherForecast\": {\r\n \"get\": {\r\n \"tags\": [\r\n \"WeatherForecast\"\r\n ],\r\n \"operationId\": \"WeatherForecast_Get\",\r\n \"produces\": [\r\n \"text/plain\",\r\n \"application/json\",\r\n \"text/json\"\r\n ],\r\n \"responses\": {\r\n \"200\": {\r\n \"x-nullable\": false,\r\n \"description\": \"\",\r\n \"schema\": {\r\n \"type\": \"array\",\r\n \"items\": {\r\n \"$ref\": \"#/definitions/WeatherForecast\"\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n },\r\n \"definitions\": {\r\n \"ChatStatus\": {\r\n \"type\": \"integer\",\r\n \"description\": \"\",\r\n \"x-enumNames\": [\r\n \"Undelivered\",\r\n \"Delivered\",\r\n \"Seen\"\r\n ],\r\n \"enum\": [\r\n 0,\r\n 1,\r\n 2\r\n ]\r\n },\r\n \"ChatMessage\": {\r\n \"type\": \"object\",\r\n \"required\": [\r\n \"id\",\r\n \"status\",\r\n \"createdDate\"\r\n ],\r\n \"properties\": {\r\n \"id\": {\r\n \"type\": \"integer\",\r\n \"format\": \"int64\"\r\n },\r\n \"fromUserId\": {\r\n \"type\": \"string\"\r\n },\r\n \"toUserId\": {\r\n \"type\": \"string\"\r\n },\r\n \"message\": {\r\n \"type\": \"string\"\r\n },\r\n \"status\": {\r\n \"$ref\": \"#/definitions/ChatStatus\"\r\n },\r\n \"createdDate\": {\r\n \"type\": \"string\",\r\n \"format\": \"date-time\"\r\n },\r\n \"fromUser\": {\r\n \"$ref\": \"#/definitions/ApplicationUser\"\r\n },\r\n \"toUser\": {\r\n \"$ref\": \"#/definitions/ApplicationUser\"\r\n }\r\n }\r\n },\r\n \"ApplicationUser\": {\r\n \"allOf\": [\r\n {\r\n \"$ref\": \"#/definitions/IdentityUser\"\r\n },\r\n {\r\n \"type\": \"object\",\r\n \"required\": [\r\n \"lastSeen\",\r\n \"unreadCount\"\r\n ],\r\n \"properties\": {\r\n \"lastSeen\": {\r\n \"type\": \"string\",\r\n \"format\": \"date-time\"\r\n },\r\n \"unreadCount\": {\r\n \"type\": \"integer\",\r\n \"format\": \"int32\"\r\n },\r\n \"chatMessagesFromUsers\": {\r\n \"type\": \"array\",\r\n \"items\": {\r\n \"$ref\": \"#/definitions/ChatMessage\"\r\n }\r\n },\r\n \"chatMessagesToUsers\": {\r\n \"type\": \"array\",\r\n \"items\": {\r\n \"$ref\": \"#/definitions/ChatMessage\"\r\n }\r\n }\r\n }\r\n }\r\n ]\r\n },\r\n \"IdentityUser\": {\r\n \"allOf\": [\r\n {\r\n \"$ref\": \"#/definitions/IdentityUserOfString\"\r\n },\r\n {\r\n \"type\": \"object\"\r\n }\r\n ]\r\n },\r\n \"IdentityUserOfString\": {\r\n \"type\": \"object\",\r\n \"required\": [\r\n \"emailConfirmed\",\r\n \"phoneNumberConfirmed\",\r\n \"twoFactorEnabled\",\r\n \"lockoutEnabled\",\r\n \"accessFailedCount\"\r\n ],\r\n \"properties\": {\r\n \"id\": {\r\n \"type\": \"string\"\r\n },\r\n \"userName\": {\r\n \"type\": \"string\"\r\n },\r\n \"normalizedUserName\": {\r\n \"type\": \"string\"\r\n },\r\n \"email\": {\r\n \"type\": \"string\"\r\n },\r\n \"normalizedEmail\": {\r\n \"type\": \"string\"\r\n },\r\n \"emailConfirmed\": {\r\n \"type\": \"boolean\"\r\n },\r\n \"passwordHash\": {\r\n \"type\": \"string\"\r\n },\r\n \"securityStamp\": {\r\n \"type\": \"string\"\r\n },\r\n \"concurrencyStamp\": {\r\n \"type\": \"string\"\r\n },\r\n \"phoneNumber\": {\r\n \"type\": \"string\"\r\n },\r\n \"phoneNumberConfirmed\": {\r\n \"type\": \"boolean\"\r\n },\r\n \"twoFactorEnabled\": {\r\n \"type\": \"boolean\"\r\n },\r\n \"lockoutEnd\": {\r\n \"type\": \"string\",\r\n \"format\": \"date-time\"\r\n },\r\n \"lockoutEnabled\": {\r\n \"type\": \"boolean\"\r\n },\r\n \"accessFailedCount\": {\r\n \"type\": \"integer\",\r\n \"format\": \"int32\"\r\n }\r\n }\r\n },\r\n \"WeatherForecast\": {\r\n \"type\": \"object\",\r\n \"required\": [\r\n \"date\",\r\n \"temperatureC\",\r\n \"temperatureF\"\r\n ],\r\n \"properties\": {\r\n \"date\": {\r\n \"type\": \"string\",\r\n \"format\": \"date-time\"\r\n },\r\n \"temperatureC\": {\r\n \"type\": \"integer\",\r\n \"format\": \"int32\"\r\n },\r\n \"summary\": {\r\n \"type\": \"string\"\r\n },\r\n \"temperatureF\": {\r\n \"type\": \"integer\",\r\n \"format\": \"int32\"\r\n }\r\n }\r\n }\r\n }\r\n}",
"url": "https://localhost:5001/swagger/v1/swagger.json",
"output": null,
"newLineBehavior": "Auto"
}
},
"codeGenerators": {
"openApiToCSharpClient": {
"clientBaseClass": null,
"configurationClass": null,
"generateClientClasses": true,
"generateClientInterfaces": false,
"clientBaseInterface": null,
"injectHttpClient": true,
"disposeHttpClient": true,
"protectedMethods": [],
"generateExceptionClasses": true,
"exceptionClass": "ApiException",
"wrapDtoExceptions": true,
"useHttpClientCreationMethod": false,
"httpClientType": "System.Net.Http.HttpClient",
"useHttpRequestMessageCreationMethod": false,
"useBaseUrl": true,
"generateBaseUrlProperty": true,
"generateSyncMethods": false,
"generatePrepareRequestAndProcessResponseAsAsyncMethods": false,
"exposeJsonSerializerSettings": false,
"clientClassAccessModifier": "public",
"typeAccessModifier": "public",
"generateContractsOutput": false,
"contractsNamespace": null,
"contractsOutputFilePath": null,
"parameterDateTimeFormat": "s",
"parameterDateFormat": "yyyy-MM-dd",
"generateUpdateJsonSerializerSettingsMethod": true,
"useRequestAndResponseSerializationSettings": false,
"serializeTypeInformation": false,
"queryNullValue": "",
"className": "{controller}Client",
"operationGenerationMode": "MultipleClientsFromOperationId",
"additionalNamespaceUsages": [],
"additionalContractNamespaceUsages": [],
"generateOptionalParameters": false,
"generateJsonMethods": false,
"enforceFlagEnums": false,
"parameterArrayType": "System.Collections.Generic.IEnumerable",
"parameterDictionaryType": "System.Collections.Generic.IDictionary",
"responseArrayType": "System.Collections.Generic.ICollection",
"responseDictionaryType": "System.Collections.Generic.IDictionary",
"wrapResponses": false,
"wrapResponseMethods": [],
"generateResponseClasses": true,
"responseClass": "SwaggerResponse",
"namespace": "ChatClientApi",
"requiredPropertiesMustBeDefined": true,
"dateType": "System.DateTimeOffset",
"jsonConverters": null,
"anyType": "object",
"dateTimeType": "System.DateTimeOffset",
"timeType": "System.TimeSpan",
"timeSpanType": "System.TimeSpan",
"arrayType": "System.Collections.Generic.ICollection",
"arrayInstanceType": "System.Collections.ObjectModel.Collection",
"dictionaryType": "System.Collections.Generic.IDictionary",
"dictionaryInstanceType": "System.Collections.Generic.Dictionary",
"arrayBaseType": "System.Collections.ObjectModel.Collection",
"dictionaryBaseType": "System.Collections.Generic.Dictionary",
"classStyle": "Poco",
"jsonLibrary": "SystemTextJson",
"generateDefaultValues": true,
"generateDataAnnotations": true,
"excludedTypeNames": [],
"excludedParameterNames": [],
"handleReferences": false,
"generateImmutableArrayProperties": false,
"generateImmutableDictionaryProperties": false,
"jsonSerializerSettingsTransformationMethod": null,
"inlineNamedArrays": false,
"inlineNamedDictionaries": false,
"inlineNamedTuples": true,
"inlineNamedAny": false,
"generateDtoTypes": false,
"generateOptionalPropertiesAsNullable": false,
"generateNullableReferenceTypes": false,
"templateDirectory": null,
"typeNameGeneratorType": null,
"propertyNameGeneratorType": null,
"enumNameGeneratorType": null,
"checksumCacheEnabled": false,
"serviceHost": null,
"serviceSchemes": null,
"output": "ChatClient.cs",
"newLineBehavior": "Auto"
}
}
}
18 changes: 18 additions & 0 deletions BlazorChat/Client/Managers/ChatClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using ChatClientApi;
using System.Net.Http;
using System.Text.Json;

namespace BlazorChat.Client.Managers
{
public class ChatClient : ChatClientGenerated
{
public ChatClient(HttpClient httpClient) : base(httpClient)
{
// https://github.com/dotnet/aspnetcore/issues/21736
base.ReadResponseAsString = true;
base.JsonSerializerSettings.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
}
}


}
Loading