From b79a4b3162dfeea2b789413bf181318f2228537c Mon Sep 17 00:00:00 2001 From: Safia Abdalla <safia@safia.rocks> Date: Thu, 22 Aug 2024 15:29:57 -0700 Subject: [PATCH] Add PACKAGE.md for CloudNative.CloudEvents Signed-off-by: Safia Abdalla <safia@safia.rocks> --- .../CloudNative.CloudEvents.csproj | 6 ++- src/CloudNative.CloudEvents/PACKAGE.md | 49 +++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 src/CloudNative.CloudEvents/PACKAGE.md diff --git a/src/CloudNative.CloudEvents/CloudNative.CloudEvents.csproj b/src/CloudNative.CloudEvents/CloudNative.CloudEvents.csproj index 27f8735..937da8e 100644 --- a/src/CloudNative.CloudEvents/CloudNative.CloudEvents.csproj +++ b/src/CloudNative.CloudEvents/CloudNative.CloudEvents.csproj @@ -6,6 +6,7 @@ <LangVersion>latest</LangVersion> <Nullable>enable</Nullable> <PackageTags>cloudnative;cloudevents;events</PackageTags> + <PackageReadmeFile>PACKAGE.md</PackageReadmeFile> </PropertyGroup> <ItemGroup> @@ -29,5 +30,8 @@ </EmbeddedResource> </ItemGroup> -</Project> + <ItemGroup> + <None Include="PACKAGE.md" Pack="true" PackagePath="\"/> +</ItemGroup> +</Project> diff --git a/src/CloudNative.CloudEvents/PACKAGE.md b/src/CloudNative.CloudEvents/PACKAGE.md new file mode 100644 index 0000000..a395d18 --- /dev/null +++ b/src/CloudNative.CloudEvents/PACKAGE.md @@ -0,0 +1,49 @@ +## About + +CloudNative.CloudEvents is a NuGet package that provides support for creating, encoding, decoding, sending, and receiving CNCF CloudEvents. + +## Key Features + +* Supports constructing a spec-compliant CloudEvent +* Provides abstractions for building custom CloudEvent formatters + +## How to Use + +To start using the CloudNative.CloudEvents package in a .NET application, follow these steps: + +### Installation + +```sh +dotnet add package CloudNative.CloudEvents +``` + +### Configuration + +In the application of your choosing, construct a `CloudEvent` as follows: + +```C# +using CloudNative.CloudEvents; + +CloudEvent cloudEvent = new CloudEvent +{ + Id = "event-id", + Type = "event-type", + Source = new Uri("https://cloudevents.io/"), + Time = DateTimeOffset.UtcNow, + DataContentType = "text/plain", + Data = "This is CloudEvent data" +}; +``` + +This package only provides the abstractions for constructing a CloudEvent. For complete deserialization and serialization behavior, you will need to use an accompanying formatter library. For more information on configuring and using CloudNative.CloudEvents, refer to the [official documentation](https://github.com/cloudevents/sdk-csharp/tree/main/docs). + +## Main Types + +The main types provided by this library are: + +* `CloudEvent`: Represents a spec-compliant CloudEvent. +* `CloudEventFormatter`: Provides an abstract class that can be extended to implement an event formatter. + +## Feedback & Contributing + +CloudNative.CloudEvents is released as open-source under the [Apache license](https://licenses.nuget.org/Apache-2.0). Bug reports and contributions are welcome at [the GitHub repository](https://github.com/cloudevents/sdk-csharp).