WebCommunicationModels 0.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package WebCommunicationModels --version 0.0.1
                    
NuGet\Install-Package WebCommunicationModels -Version 0.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WebCommunicationModels" Version="0.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WebCommunicationModels" Version="0.0.1" />
                    
Directory.Packages.props
<PackageReference Include="WebCommunicationModels" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WebCommunicationModels --version 0.0.1
                    
#r "nuget: WebCommunicationModels, 0.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package WebCommunicationModels@0.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=WebCommunicationModels&version=0.0.1
                    
Install as a Cake Addin
#tool nuget:?package=WebCommunicationModels&version=0.0.1
                    
Install as a Cake Tool

WebCommunicationModels

Eine einfache .NET Standard 2.1 Klassenbibliothek mit wiederverwendbaren Datenmodellen für Web-Kommunikation.

Übersicht

Dieses Projekt bietet standardisierte Modelle für die Kommunikation zwischen Web-APIs und Clients. Die Modelle ermöglichen eine konsistente Struktur für API-Antworten, Pagination, Benachrichtigungen und Dateiverarbeitung.

Modelle

ApiResponse<T>

Standardisierte API-Antwortstruktur mit generischem Datentyp.

Eigenschaften:

  • Status: Antwortstatus ("success", "fail", "error", "forbidden")
  • Data: Generische Daten vom Typ T
  • Message: Beschreibung der Antwort
  • Notifications: Liste von Benachrichtigungen

Hilfsmethoden:

  • Success(data, message): Erstellt erfolgreiche Antwort
  • Fail(data, message): Erstellt Fehler-Antwort
  • Error(data, message): Erstellt Error-Antwort
  • Forbidden(data, message): Erstellt Verboten-Antwort

Notification

Benachrichtigungsmodell für Client-Nachrichten.

Eigenschaften:

  • Severity: Art der Benachrichtigung ("success", "info", "warning", "error")
  • Message: Benachrichtigungstext
  • Title: Titel (optional)
  • Variables: Zusätzliche Variablen (optional)

Hilfsmethoden:

  • Success(message, title, variables)
  • Info(message, title, variables)
  • Warning(message, title, variables)
  • Error(message, title, variables)

FileModel

Modell für Datei-Upload und -Download mit Base64-Unterstützung.

Eigenschaften:

  • Content: Binärer Dateiinhalt (byte[])
  • Base64EncodedContent: Base64-kodierter Dateiinhalt (string)
  • Name: Dateiname
  • ContentType: MIME-Type (z.B. "application/pdf")

Methoden:

  • ToBase64(): Konvertiert Binär zu Base64 (löscht Original)
  • FromBase64(): Konvertiert Base64 zu Binär (löscht Base64)

Paging

Parameter für Datenpagination.

Eigenschaften:

  • Filter: Suchfilter (Standard: "")
  • Skip: Übersprungene Datensätze (Standard: 0)
  • Take: Anzahl abzurufender Datensätze (Standard: 10)

PaginationResponse<T>

Antwort mit paginierten Daten.

Eigenschaften:

  • Total: Gesamtanzahl der Datensätze
  • Items: Abgerufene Datensätze

Anforderungen

  • .NET Standard 2.1 oder höher
  • C# 8.0 oder höher

Verwendungsbeispiel

// Beispiel für die Verwendung von ApiResponse
var response = ApiResponse<string>.Success("Daten erfolgreich geladen", "Die Anfrage war erfolgreich");

// Beispiel für die Verwendung von Notification
var notification = Notification.Success("Die Datei wurde hochgeladen", "Hochladen erfolgreich");

// Beispiel für die Verwendung von FileModel
var fileModel = new FileModel
{
    Name = "beispiel.pdf",
    ContentType = "application/pdf"
};
fileModel.FromBase64("JVBERi0xLjQKJaqrrw0K..."); // Base64 string gekürzt
var base64String = fileModel.ToBase64();

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.2 162 1/13/2026
0.0.1 96 1/12/2026