Table of Contents

Interface IRustPlus

Namespace
RustPlusApi.Interfaces
Assembly
RustPlusApi.dll

High-level Rust+ API contract — typed events and all supported server commands.

public interface IRustPlus : IRustPlusSocket, IDisposable, IAsyncDisposable
Inherited Members

Methods

CheckSubscriptionAsync(ulong, CancellationToken)

Checks whether the player is subscribed to push notifications from a smart alarm.

Task<Response<SubscriptionInfo?>> CheckSubscriptionAsync(ulong alarmId, CancellationToken cancellationToken = default)

Parameters

alarmId ulong

Entity ID of the smart alarm.

cancellationToken CancellationToken

A token to observe for cancellation requests.

Returns

Task<Response<SubscriptionInfo>>

GetAlarmInfoAsync(ulong, CancellationToken)

Returns the current state of a smart alarm entity.

Task<Response<SmartDeviceInfo?>> GetAlarmInfoAsync(ulong entityId, CancellationToken cancellationToken = default)

Parameters

entityId ulong

Entity ID of the alarm.

cancellationToken CancellationToken

A token to observe for cancellation requests.

Returns

Task<Response<SmartDeviceInfo>>

Remarks

The underlying getEntityInfo request also subscribes this connection to the entity's EntityChanged broadcasts server-side — even when the read itself fails on a type mismatch.

GetClanChatAsync(CancellationToken)

Returns recent clan chat messages.

Task<Response<ClanChatInfo?>> GetClanChatAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token to observe for cancellation requests.

Returns

Task<Response<ClanChatInfo>>

GetClanInfoAsync(CancellationToken)

Returns the full clan snapshot for the authenticated player's clan.

Task<Response<ClanInfo?>> GetClanInfoAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token to observe for cancellation requests.

Returns

Task<Response<ClanInfo>>

GetInfoAsync(CancellationToken)

Returns server metadata (name, map, player counts, etc.).

Task<Response<ServerInfo?>> GetInfoAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token to observe for cancellation requests.

Returns

Task<Response<ServerInfo>>

GetMapAsync(CancellationToken)

Returns the server map image and monument list.

Task<Response<ServerMap?>> GetMapAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token to observe for cancellation requests.

Returns

Task<Response<ServerMap>>

GetMapMarkersAsync(CancellationToken)

Returns all current map markers (players, cargo ship, vending machines, etc.).

Task<Response<MapMarkers?>> GetMapMarkersAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token to observe for cancellation requests.

Returns

Task<Response<MapMarkers>>

GetNexusAuthAsync(string, CancellationToken)

Obtains a Nexus cross-server authentication token.

Task<Response<NexusAuth?>> GetNexusAuthAsync(string appKey, CancellationToken cancellationToken = default)

Parameters

appKey string

The application key identifying the target Nexus server.

cancellationToken CancellationToken

A token to observe for cancellation requests.

Returns

Task<Response<NexusAuth>>

GetSmartDeviceInfoAsync(ulong, CancellationToken)

Returns the state of a binary-state smart device (a smart switch or a smart alarm), whichever of the two types the entity actually is.

Task<Response<SmartDeviceInfo?>> GetSmartDeviceInfoAsync(ulong entityId, CancellationToken cancellationToken = default)

Parameters

entityId ulong

Entity ID of the smart device.

cancellationToken CancellationToken

A token to observe for cancellation requests.

Returns

Task<Response<SmartDeviceInfo>>

Remarks

The underlying getEntityInfo request also subscribes this connection to the entity's EntityChanged broadcasts server-side — even when the read itself fails on a type mismatch.

GetSmartSwitchInfoAsync(ulong, CancellationToken)

Returns the current state of a smart switch entity.

Task<Response<SmartDeviceInfo?>> GetSmartSwitchInfoAsync(ulong entityId, CancellationToken cancellationToken = default)

Parameters

entityId ulong

Entity ID of the smart switch.

cancellationToken CancellationToken

A token to observe for cancellation requests.

Returns

Task<Response<SmartDeviceInfo>>

Remarks

The underlying getEntityInfo request also subscribes this connection to the entity's EntityChanged broadcasts server-side — even when the read itself fails on a type mismatch.

GetStorageMonitorInfoAsync(ulong, CancellationToken)

Returns the current contents and protection state of a storage monitor.

Task<Response<StorageMonitorInfo?>> GetStorageMonitorInfoAsync(ulong entityId, CancellationToken cancellationToken = default)

Parameters

entityId ulong

Entity ID of the storage monitor.

cancellationToken CancellationToken

A token to observe for cancellation requests.

Returns

Task<Response<StorageMonitorInfo>>

Remarks

The underlying getEntityInfo request also subscribes this connection to the entity's EntityChanged broadcasts server-side — even when the read itself fails on a type mismatch.

GetTeamChatAsync(CancellationToken)

Returns recent team chat messages.

Task<Response<TeamChatInfo?>> GetTeamChatAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token to observe for cancellation requests.

Returns

Task<Response<TeamChatInfo>>

GetTeamInfoAsync(CancellationToken)

Returns the full team snapshot including all member statuses and map notes.

Task<Response<TeamInfo?>> GetTeamInfoAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token to observe for cancellation requests.

Returns

Task<Response<TeamInfo>>

GetTimeAsync(CancellationToken)

Returns the current in-game time and day/night cycle parameters.

Task<Response<TimeInfo?>> GetTimeAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token to observe for cancellation requests.

Returns

Task<Response<TimeInfo>>

KickFromTeamAsync(ulong, CancellationToken)

Kicks a member out of the team.

Task<Response> KickFromTeamAsync(ulong steamId, CancellationToken cancellationToken = default)

Parameters

steamId ulong

Steam64 ID of the member to kick.

cancellationToken CancellationToken

A token to observe for cancellation requests.

Returns

Task<Response>

PromoteToLeaderAsync(ulong, CancellationToken)

Promotes a team member to team leader.

Task<Response> PromoteToLeaderAsync(ulong steamId, CancellationToken cancellationToken = default)

Parameters

steamId ulong

Steam64 ID of the member to promote.

cancellationToken CancellationToken

A token to observe for cancellation requests.

Returns

Task<Response>

SendCameraInputAsync(CameraButtons, float, float, CancellationToken)

Sends movement / action input to the currently subscribed camera.

Task<Response> SendCameraInputAsync(CameraButtons buttons, float mouseDeltaX = 0, float mouseDeltaY = 0, CancellationToken cancellationToken = default)

Parameters

buttons CameraButtons

Bitmask of buttons to press.

mouseDeltaX float

Horizontal mouse delta.

mouseDeltaY float

Vertical mouse delta.

cancellationToken CancellationToken

A token to observe for cancellation requests.

Returns

Task<Response>

SendClanMessageAsync(string, CancellationToken)

Posts a message to the clan chat.

Task<Response> SendClanMessageAsync(string message, CancellationToken cancellationToken = default)

Parameters

message string

The message text to send.

cancellationToken CancellationToken

A token to observe for cancellation requests.

Returns

Task<Response>

SendTeamMessageAsync(string, CancellationToken)

Posts a message to the team chat.

Task<Response<TeamMessage?>> SendTeamMessageAsync(string message, CancellationToken cancellationToken = default)

Parameters

message string

The message text to send.

cancellationToken CancellationToken

A token to observe for cancellation requests.

Returns

Task<Response<TeamMessage>>

SetClanMotdAsync(string, CancellationToken)

Sets the clan's message of the day.

Task<Response> SetClanMotdAsync(string message, CancellationToken cancellationToken = default)

Parameters

message string

The new MOTD text.

cancellationToken CancellationToken

A token to observe for cancellation requests.

Returns

Task<Response>

SetSmartSwitchValueAsync(ulong, bool, CancellationToken)

Sets a smart switch to a specific on/off state.

Task<Response<SmartDeviceInfo?>> SetSmartSwitchValueAsync(ulong smartSwitchId, bool smartSwitchValue, CancellationToken cancellationToken = default)

Parameters

smartSwitchId ulong

Entity ID of the smart switch.

smartSwitchValue bool

true to turn on, false to turn off.

cancellationToken CancellationToken

A token to observe for cancellation requests.

Returns

Task<Response<SmartDeviceInfo>>

SetSubscriptionAsync(ulong, bool, CancellationToken)

Subscribes or unsubscribes from push notifications for a smart alarm.

Task<Response> SetSubscriptionAsync(ulong entityId, bool doSubscribe = true, CancellationToken cancellationToken = default)

Parameters

entityId ulong

Entity ID of the alarm.

doSubscribe bool

true to subscribe, false to unsubscribe.

cancellationToken CancellationToken

A token to observe for cancellation requests.

Returns

Task<Response>

StrobeSmartSwitchAsync(ulong, int, bool, CancellationToken)

Pulses a smart switch on then off (or off then on) with the specified delay, implementing a simple strobe / one-shot trigger pattern.

Task<Response<SmartDeviceInfo?>> StrobeSmartSwitchAsync(ulong entityId, int timeoutMilliseconds = 1000, bool value = true, CancellationToken cancellationToken = default)

Parameters

entityId ulong

Entity ID of the smart switch.

timeoutMilliseconds int

Duration to hold the initial state before reverting, in milliseconds.

value bool

Initial state to pulse the switch to.

cancellationToken CancellationToken

A token to observe for cancellation requests.

Returns

Task<Response<SmartDeviceInfo>>

SubscribeToCameraAsync(string, CancellationToken)

Subscribes to a camera's ray stream and returns its info.

Task<Response<CameraInfo?>> SubscribeToCameraAsync(string cameraId, CancellationToken cancellationToken = default)

Parameters

cameraId string

In-game identifier of the camera entity.

cancellationToken CancellationToken

A token to observe for cancellation requests.

Returns

Task<Response<CameraInfo>>

ToggleSmartSwitchAsync(ulong, CancellationToken)

Toggles a smart switch — turns it on if off, or off if on.

Task<Response<SmartDeviceInfo?>> ToggleSmartSwitchAsync(ulong entityId, CancellationToken cancellationToken = default)

Parameters

entityId ulong

Entity ID of the smart switch.

cancellationToken CancellationToken

A token to observe for cancellation requests.

Returns

Task<Response<SmartDeviceInfo>>

UnsubscribeFromCameraAsync(CancellationToken)

Unsubscribes from the currently subscribed camera.

Task<Response> UnsubscribeFromCameraAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token to observe for cancellation requests.

Returns

Task<Response>

Events

OnCameraRaysReceived

Raised when a camera rays broadcast is received for the subscribed camera.

event EventHandler<CameraRaysEventArg>? OnCameraRaysReceived

Event Type

EventHandler<CameraRaysEventArg>

OnClanChanged

Raised when the clan snapshot changes.

event EventHandler<ClanChangedEventArg>? OnClanChanged

Event Type

EventHandler<ClanChangedEventArg>

OnClanChatReceived

Raised when a new clan chat message arrives.

event EventHandler<ClanMessageEventArg>? OnClanChatReceived

Event Type

EventHandler<ClanMessageEventArg>

OnEntityChanged

Raised for every EntityChanged broadcast, before any device-type heuristic, with the full raw payload. The broadcast carries no entity type; consumers that know their paired entity ids should route on Id.

event EventHandler<EntityChangedEventArg>? OnEntityChanged

Event Type

EventHandler<EntityChangedEventArg>

OnSmartDeviceTriggered

Occurs when an EntityChanged broadcast is classified as a binary-state smart device (a smart switch or a smart alarm): the payload carries no container state (no items, no capacity, no protection). The broadcast omits the entity type, so a storage broadcast whose payload is only value is indistinguishable from a switch and lands here too — route on OnEntityChanged with your paired entity ids when that matters.

event EventHandler<SmartDeviceEventArg>? OnSmartDeviceTriggered

Event Type

EventHandler<SmartDeviceEventArg>

OnStorageMonitorTriggered

Occurs when an EntityChanged broadcast is classified as a storage monitor: the payload carries items, a capacity, or tool-cupboard protection. Storage broadcasts with value == true and no items carry no contents snapshot and are NOT raised here (they remain observable via OnEntityChanged). Tool-cupboard broadcasts are sometimes partial — capacity may be absent and only the protection flag identifies them.

event EventHandler<StorageMonitorEventArg>? OnStorageMonitorTriggered

Event Type

EventHandler<StorageMonitorEventArg>

OnTeamChanged

Raised when the team snapshot changes.

event EventHandler<TeamChangedEventArg>? OnTeamChanged

Event Type

EventHandler<TeamChangedEventArg>

OnTeamChatReceived

Raised when a new team chat message arrives.

event EventHandler<TeamMessageEventArg>? OnTeamChatReceived

Event Type

EventHandler<TeamMessageEventArg>