#### [Abblix\.SecurityEvents](https://www.abblix.com/en/docs/api/abblix-securityevents 'index')
### [Abblix\.SecurityEvents](https://www.abblix.com/en/docs/api/abblix-securityevents/Abblix.SecurityEvents 'Abblix\.SecurityEvents')

## EventsCollection Class

The value of the "events" claim: the event statements a SET expresses, each a name/value pair
whose name is the event identifier URI and whose value is the event's payload
\(RFC 8417 Section 2\.2\)\.

```csharp
public sealed class EventsCollection : System.Collections.Generic.IReadOnlyCollection<System.Collections.Generic.KeyValuePair<string, System.Text.Json.Nodes.JsonObject>>, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, System.Text.Json.Nodes.JsonObject>>, System.Collections.IEnumerable
```

Inheritance [System\.Object](https://learn.microsoft.com/en-us/dotnet/api/system.object 'System\.Object') → EventsCollection

Implements [System\.Collections\.Generic\.IReadOnlyCollection&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ireadonlycollection-1 'System\.Collections\.Generic\.IReadOnlyCollection\`1')[System\.Collections\.Generic\.KeyValuePair&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.keyvaluepair-2 'System\.Collections\.Generic\.KeyValuePair\`2')[System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String')[,](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.keyvaluepair-2 'System\.Collections\.Generic\.KeyValuePair\`2')[System\.Text\.Json\.Nodes\.JsonObject](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.nodes.jsonobject 'System\.Text\.Json\.Nodes\.JsonObject')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.keyvaluepair-2 'System\.Collections\.Generic\.KeyValuePair\`2')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ireadonlycollection-1 'System\.Collections\.Generic\.IReadOnlyCollection\`1'), [System\.Collections\.Generic\.IEnumerable&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1 'System\.Collections\.Generic\.IEnumerable\`1')[System\.Collections\.Generic\.KeyValuePair&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.keyvaluepair-2 'System\.Collections\.Generic\.KeyValuePair\`2')[System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String')[,](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.keyvaluepair-2 'System\.Collections\.Generic\.KeyValuePair\`2')[System\.Text\.Json\.Nodes\.JsonObject](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.nodes.jsonobject 'System\.Text\.Json\.Nodes\.JsonObject')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.keyvaluepair-2 'System\.Collections\.Generic\.KeyValuePair\`2')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1 'System\.Collections\.Generic\.IEnumerable\`1'), [System\.Collections\.IEnumerable](https://learn.microsoft.com/en-us/dotnet/api/system.collections.ienumerable 'System\.Collections\.IEnumerable')

### Remarks
The statements of one SET describe aspects of ONE state transition: RFC 8417 Section 2 says
multiple identifiers "represent multiple aspects of the same state transition" and Section 2\.2
that the claim "MUST NOT be used to express multiple independent logical events"\. That rule is
about meaning, so no code can check it \- it is the caller's to honour when adding a second
statement\.
### Constructors

## EventsCollection\(\) Constructor {#Abblix.SecurityEvents.EventsCollection.EventsCollection()}

Creates an empty collection, to be filled through [Add\(string, JsonObject\)](https://www.abblix.com/en/docs/api/abblix-securityevents/Abblix.SecurityEvents.EventsCollection#Abblix.SecurityEvents.EventsCollection.Add(string,System.Text.Json.Nodes.JsonObject) 'Abblix\.SecurityEvents\.EventsCollection\.Add\(string, System\.Text\.Json\.Nodes\.JsonObject\)')\.

```csharp
public EventsCollection();
```

## EventsCollection\(JsonObject\) Constructor {#Abblix.SecurityEvents.EventsCollection.EventsCollection(System.Text.Json.Nodes.JsonObject)}

The value of the "events" claim: the event statements a SET expresses, each a name/value pair
whose name is the event identifier URI and whose value is the event's payload
\(RFC 8417 Section 2\.2\)\.

```csharp
public EventsCollection(System.Text.Json.Nodes.JsonObject json);
```
#### Parameters

###### `json` [System\.Text\.Json\.Nodes\.JsonObject](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.nodes.jsonobject 'System\.Text\.Json\.Nodes\.JsonObject') {#Abblix.SecurityEvents.EventsCollection.EventsCollection(System.Text.Json.Nodes.JsonObject).json}

The JSON object holding the event statements, read and written in place, never copied\.

### Remarks
The statements of one SET describe aspects of ONE state transition: RFC 8417 Section 2 says
multiple identifiers "represent multiple aspects of the same state transition" and Section 2\.2
that the claim "MUST NOT be used to express multiple independent logical events"\. That rule is
about meaning, so no code can check it \- it is the caller's to honour when adding a second
statement\.
### Properties

## EventsCollection\.Count Property {#Abblix.SecurityEvents.EventsCollection.Count}

The number of event statements\. RFC 8417 Section 2 requires at least one in a valid SET;
whether that holds for a token read off the wire is the validation pipeline's question\.

```csharp
public int Count { get; }
```

Implements [Count](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ireadonlycollection-1.count 'System\.Collections\.Generic\.IReadOnlyCollection\`1\.Count')

#### Property Value
[System\.Int32](https://learn.microsoft.com/en-us/dotnet/api/system.int32 'System\.Int32')

## EventsCollection\.Json Property {#Abblix.SecurityEvents.EventsCollection.Json}

The underlying JSON object, in the exact shape the "events" claim carries on the wire\.

```csharp
public System.Text.Json.Nodes.JsonObject Json { get; }
```

#### Property Value
[System\.Text\.Json\.Nodes\.JsonObject](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.nodes.jsonobject 'System\.Text\.Json\.Nodes\.JsonObject')
### Methods

## EventsCollection\.Add\(string, JsonObject\) Method {#Abblix.SecurityEvents.EventsCollection.Add(string,System.Text.Json.Nodes.JsonObject)}

Adds an event statement\.

```csharp
public void Add(string eventType, System.Text.Json.Nodes.JsonObject? payload=null);
```
#### Parameters

###### `eventType` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.SecurityEvents.EventsCollection.Add(string,System.Text.Json.Nodes.JsonObject).eventType}

The event identifier URI\. RFC 8417 Section 2\.2 asks for stable values, such as a permanent
URL of the event's specification\.

###### `payload` [System\.Text\.Json\.Nodes\.JsonObject](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.nodes.jsonobject 'System\.Text\.Json\.Nodes\.JsonObject') {#Abblix.SecurityEvents.EventsCollection.Add(string,System.Text.Json.Nodes.JsonObject).payload}

The event's payload\. The parameter type already keeps Section 2\.2's "the corresponding
value MUST be a JSON object"\. Null stands for an event with no payload claims, which
"SHALL be represented as the empty JSON object" \(RFC 8417 Section 2\) \- the empty object is
written here so no caller has to remember that rule\.

#### Exceptions

[System\.ArgumentException](https://learn.microsoft.com/en-us/dotnet/api/system.argumentexception 'System\.ArgumentException')  
A statement with the same event identifier is already present \- "Multiple event identifiers
with the same value MUST NOT be used" \(RFC 8417 Section 2\.2\) \- or the payload is still
attached to another JSON tree; pass a copy of a parsed node rather than the node itself\.

## EventsCollection\.Contains\(string\) Method {#Abblix.SecurityEvents.EventsCollection.Contains(string)}

Tells whether a statement with the given event identifier is present\.

```csharp
public bool Contains(string eventType);
```
#### Parameters

###### `eventType` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.SecurityEvents.EventsCollection.Contains(string).eventType}

The event identifier URI\.

#### Returns
[System\.Boolean](https://learn.microsoft.com/en-us/dotnet/api/system.boolean 'System\.Boolean')

## EventsCollection\.GetEnumerator\(\) Method {#Abblix.SecurityEvents.EventsCollection.GetEnumerator()}

Enumerates the event statements as \(event identifier, payload\) pairs\.

```csharp
public System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<string,System.Text.Json.Nodes.JsonObject>> GetEnumerator();
```

Implements [GetEnumerator\(\)](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1.getenumerator 'System\.Collections\.Generic\.IEnumerable\`1\.GetEnumerator'), [GetEnumerator\(\)](https://learn.microsoft.com/en-us/dotnet/api/system.collections.ienumerable.getenumerator 'System\.Collections\.IEnumerable\.GetEnumerator')

#### Returns
[System\.Collections\.Generic\.IEnumerator&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerator-1 'System\.Collections\.Generic\.IEnumerator\`1')[System\.Collections\.Generic\.KeyValuePair&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.keyvaluepair-2 'System\.Collections\.Generic\.KeyValuePair\`2')[System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String')[,](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.keyvaluepair-2 'System\.Collections\.Generic\.KeyValuePair\`2')[System\.Text\.Json\.Nodes\.JsonObject](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.nodes.jsonobject 'System\.Text\.Json\.Nodes\.JsonObject')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.keyvaluepair-2 'System\.Collections\.Generic\.KeyValuePair\`2')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerator-1 'System\.Collections\.Generic\.IEnumerator\`1')

#### Exceptions

[System\.InvalidOperationException](https://learn.microsoft.com/en-us/dotnet/api/system.invalidoperationexception 'System\.InvalidOperationException')  
A statement's value is not a JSON object\. RFC 8417 Section 2\.2 forbids that shape, and this
view refuses to invent a payload for it; the validation pipeline is where such a token gets
its verdict\.

## EventsCollection\.TryGetPayload\(string, JsonObject\) Method {#Abblix.SecurityEvents.EventsCollection.TryGetPayload(string,System.Text.Json.Nodes.JsonObject)}

Retrieves the payload of the statement with the given event identifier\.

```csharp
public bool TryGetPayload(string eventType, out System.Text.Json.Nodes.JsonObject payload);
```
#### Parameters

###### `eventType` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.SecurityEvents.EventsCollection.TryGetPayload(string,System.Text.Json.Nodes.JsonObject).eventType}

The event identifier URI\.

###### `payload` [System\.Text\.Json\.Nodes\.JsonObject](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.nodes.jsonobject 'System\.Text\.Json\.Nodes\.JsonObject') {#Abblix.SecurityEvents.EventsCollection.TryGetPayload(string,System.Text.Json.Nodes.JsonObject).payload}

The event's payload object when present and well\-formed\.

#### Returns
[System\.Boolean](https://learn.microsoft.com/en-us/dotnet/api/system.boolean 'System\.Boolean')  
True when the statement exists and its value is a JSON object, as RFC 8417 Section 2\.2
requires; false when it is absent or malformed\.
