Event Channels

An EventChannel is a named grouping of EventSubscriptions.

List Event Channels

SDK Method

EventChannel.List();

Return Object

FilesList<EventChannel>

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Additional Arguments

Example Request

using FilesCom.Models;

try
{
    var eventChannelIterator = EventChannel.List();
    foreach (EventChannel eventChannel in eventChannelIterator.ListAutoPaging()) {
        // Operate on eventChannel
    }
}
catch (FilesCom.NotAuthenticatedException e)
{
    Console.WriteLine($"Authentication Error Occurred ({e.GetType().Name}): " + e.Message);
}
catch (FilesCom.SdkException e)
{
    Console.WriteLine($"Unknown Error Occurred ({e.GetType().Name}): " + e.Message);
}

Show Event Channel

SDK Method

EventChannel.Find();

Return Object

EventChannel

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Method Arguments

ArgumentDescription
id
int64
Required
Event Channel ID.

Example Request

using FilesCom.Models;

try
{
    var eventChannel = await EventChannel.Find(id);
    // Operate on eventChannel
}
catch (FilesCom.NotAuthenticatedException e)
{
    Console.WriteLine($"Authentication Error Occurred ({e.GetType().Name}): " + e.Message);
}
catch (FilesCom.SdkException e)
{
    Console.WriteLine($"Unknown Error Occurred ({e.GetType().Name}): " + e.Message);
}

Create Event Channel

SDK Method

EventChannel.Create();

Return Object

EventChannel

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Method Arguments

ArgumentDefaultDescription
name
string
Required
Event Channel name.
workspace_id
int64
0Workspace ID. 0 means the default workspace.
description
string
Event Channel description.
enabled
boolean
trueWhether this Event Channel can dispatch events.
default_channel
boolean
falseWhether this Event Channel is the default destination for newly published events.

Example Request

using FilesCom.Models;

var parameters = new Dictionary<string, object>();
parameters.Add("name", "example");

try
{
    var eventChannel = await EventChannel.Create(parameters);
    // Operate on eventChannel
}
catch (FilesCom.NotAuthenticatedException e)
{
    Console.WriteLine($"Authentication Error Occurred ({e.GetType().Name}): " + e.Message);
}
catch (FilesCom.SdkException e)
{
    Console.WriteLine($"Unknown Error Occurred ({e.GetType().Name}): " + e.Message);
}

Update Event Channel

SDK Method

eventChannel.Update();

Return Object

EventChannel

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Method Arguments

ArgumentDescription
name
string
Event Channel name.
workspace_id
int64
Workspace ID. 0 means the default workspace.
description
string
Event Channel description.
enabled
boolean
Whether this Event Channel can dispatch events.
default_channel
boolean
Whether this Event Channel is the default destination for newly published events.

Example Request

using FilesCom.Models;

var parameters = new Dictionary<string, object>();
parameters.Add("name", "example");

try
{
    // Find the eventChannel object by its id.
    var eventChannel = await EventChannel.Find(id);
    await eventChannel.Update(parameters);
}
catch (FilesCom.NotAuthenticatedException e)
{
    Console.WriteLine($"Authentication Error Occurred ({e.GetType().Name}): " + e.Message);
}
catch (FilesCom.SdkException e)
{
    Console.WriteLine($"Unknown Error Occurred ({e.GetType().Name}): " + e.Message);
}

Delete Event Channel

SDK Method

eventChannel.Delete();

Return Object

No return value.

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Example Request

using FilesCom.Models;

try
{
    // Find the eventChannel object by its id.
    var eventChannel = await EventChannel.Find(id);
    await eventChannel.Delete();
}
catch (FilesCom.NotAuthenticatedException e)
{
    Console.WriteLine($"Authentication Error Occurred ({e.GetType().Name}): " + e.Message);
}
catch (FilesCom.SdkException e)
{
    Console.WriteLine($"Unknown Error Occurred ({e.GetType().Name}): " + e.Message);
}

The EventChannel Object

Some of the methods above return a EventChannel object. The attributes of this object are listed below.

AttributeDescription
id
int64
Event Channel ID
name
string
Event Channel name.
workspace_id
int64
Workspace ID. 0 means the default workspace.
description
string
Event Channel description.
enabled
boolean
Whether this Event Channel can dispatch events.
default_channel
boolean
Whether this Event Channel is the default destination for newly published events.
created_at
date-time
Event Channel create date/time.
updated_at
date-time
Event Channel update date/time.