EventService.GetEvents
Reference
PagedData<Event> GetEvents(Filters.EventFilter eventFilter)
Use GetEvents to get a paginated list of events based on eventFilter.
Parameters
-
Filters.EventFilter eventFilter: EventFilterDateTime? StartDate: The Event created start date for which event need to be fetched. Optional parameter.DateTime? EndDate: The Event created end date for which event need to be fetched. Optional parameter.int Skip: Number of records to skip. Optional parameter. Default value is 0.int Take: Number of records to fetch. Optional parameter. Default value is 100.string[] InstanceTypeNames: Array of instance type names to filter the event with. Optional parameter.string[] EventTypes: Array of event type names to filter the event with. Optional parameter.string SortBy: Attribute name to sort the instances by. Optional parameter. Default value is "EventCreated"bool IsSortByDescending: Flag to indicate whether to sort events by descending order of the value of attribute specified in SortBy. Optional parameter. Default value is true.AttributeFilterCondition[] AttributeFilter: Attribute filter indicates whether the returned event should have list based on the specified Attribute filter. Optional parameter.
-
AttributeFilterCondition: AttributeFilter
Returns
-
PagedData<Event>:int TotalCount: Total number of records after applying all specified filters.int Skip: Skip parameter value provided.int Take: Take parameter value provided.IEnumerable<Event> Items:
-
Event:
Caveats
Usage
- Using
AttributeFilter
var eventFilter = new Prorigo.Protrak.API.Contracts.Filters.EventFilter()
{
Skip = 0,
Take = int.MaxValue,
StartDate = <startDate>,
EndDate = <EndDate>,
InstanceTypeNames = new string[] { "<InstanceTypeNames>" },
EventTypes = new string[] { "<EventTypes>" },
SortBy = "<SortBy>",
IsSortByDescending = <true/false>,
AttributeFilter = new AttributeFilterCondition[]
{
new AttributeFilterCondition()
{
AttributeName = "<AttributeName>",
Condition = AttributeFilterOperator.None,
FirstValue = "<FirstValue>",
SecondValue = "<SecondValue>",
Operator = LogicalOperator.None
}
}
};
var events = new List<Event>(){};
var pagedData = EventService.GetEvents(eventFilter);
if(pagedData != null && pagedData.Items != null)
{
events = pagedData.Items.ToList();
}