Event Channels

An EventChannel is a named grouping of EventSubscriptions.

List Event Channels

SDK Method

\Files\Model\EventChannel::list;

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.

Additional Arguments

Example Request

try {
  $event_channels = \Files\Model\EventChannel::list();
  foreach ($event_channels as $event_channel) {
    // Operate on $event_channel
  }
} catch (\Files\NotAuthenticated\InvalidUsernameOrPasswordException $e) {
  echo 'Authentication Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
} catch (\Files\FilesException $e) {
  echo 'Unknown Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
}

Show Event Channel

SDK Method

\Files\Model\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

try {
  $event_channel = \Files\Model\EventChannel::find($id);
  // Operate on $event_channel
} catch (\Files\NotAuthenticated\InvalidUsernameOrPasswordException $e) {
  echo 'Authentication Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
} catch (\Files\FilesException $e) {
  echo 'Unknown Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
}

Create Event Channel

SDK Method

\Files\Model\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

try {
  $event_channel = \Files\Model\EventChannel::create([
    'name' => "example"
  ]);
  // Operate on $event_channel
} catch (\Files\NotAuthenticated\InvalidUsernameOrPasswordException $e) {
  echo 'Authentication Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
} catch (\Files\FilesException $e) {
  echo 'Unknown Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
}

Update Event Channel

SDK Method

$event_channel->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

try {
  // Find the event_channel object by its id.
  $event_channel = \Files\Model\EventChannel::find(id);
  $event_channel->update([
    'name' => "example"
  ]);
} catch (\Files\NotAuthenticated\InvalidUsernameOrPasswordException $e) {
  echo 'Authentication Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
} catch (\Files\FilesException $e) {
  echo 'Unknown Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
}

Delete Event Channel

SDK Method

$event_channel->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

try {
  // Find the event_channel object by its id.
  $event_channel = \Files\Model\EventChannel::find(id);
  $event_channel->delete();
} catch (\Files\NotAuthenticated\InvalidUsernameOrPasswordException $e) {
  echo 'Authentication Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
} catch (\Files\FilesException $e) {
  echo 'Unknown Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
}

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.