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

Add PACKAGE.md for CloudNative.CloudEvents #309

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
6 changes: 5 additions & 1 deletion src/CloudNative.CloudEvents/CloudNative.CloudEvents.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<PackageTags>cloudnative;cloudevents;events</PackageTags>
<PackageReadmeFile>PACKAGE.md</PackageReadmeFile>
</PropertyGroup>

<ItemGroup>
Expand All @@ -29,5 +30,8 @@
</EmbeddedResource>
</ItemGroup>

</Project>
<ItemGroup>
<None Include="PACKAGE.md" Pack="true" PackagePath="\"/>
</ItemGroup>

</Project>
49 changes: 49 additions & 0 deletions src/CloudNative.CloudEvents/PACKAGE.md
Original file line number Diff line number Diff line change
@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly add the HTTP binding support that's in this core package?


## 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).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly give an example one such formatter library? (I'd use the System.Text.Json formatter, personally.)


## 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly mention extension methods (the names of the types are probably irrelevant) for HTTP conversion?


## 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).
Loading