### InstallAsync Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Fcm.Registration.Steps.AndroidFcmRegister.html Performs the Firebase installation step, returning the installation authentication token. ```APIDOC ## InstallAsync(CancellationToken cancellationToken) ### Description Step 2 — Firebase installation, returning the installation auth token. ### Parameters #### Parameters - `cancellationToken` CancellationToken - Token to cancel the operation. ### Returns Task #### Exceptions InvalidOperationException - Thrown when the Firebase installation response does not contain an auth token. ``` -------------------------------- ### Install DocFX Source: https://handys11.github.io/RustPlusApi/development/building-docs.html Installs DocFX as a global .NET tool. Ensure the .NET 10 SDK is installed and the tools directory is on your PATH. ```bash dotnet tool install --global docfx ``` -------------------------------- ### InstallAsync Method Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Fcm.Registration.Steps.AndroidFcmRegister.html Executes the Firebase installation step, returning the installation authentication token. Throws an InvalidOperationException if the response does not contain an auth token. ```csharp public Task InstallAsync(CancellationToken cancellationToken = default)__ ``` -------------------------------- ### Get Server Info Async Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.RustPlus.html Retrieves the general server information. Requires a cancellation token. ```csharp public Task> GetInfoAsync(CancellationToken cancellationToken = default)__ ``` -------------------------------- ### Connect and Get Server Info Source: https://handys11.github.io/RustPlusApi/articles/getting-started.html Establishes a connection to a Rust server using provided credentials and retrieves basic server information. ```csharp using RustPlusApi; using var rustPlus = new RustPlus(new RustPlusConnection(server, port, playerId, playerToken)); await rustPlus.ConnectAsync(); var info = await rustPlus.GetInfoAsync(); if (info.IsSuccess) Console.WriteLine($"{info.Data!.Name} — {info.Data.PlayerCount}/{info.Data.MaxPlayerCount} players"); ``` -------------------------------- ### Add RustPlusApi Packages Source: https://handys11.github.io/RustPlusApi/articles/getting-started.html Installs the core RustPlusApi package and optional extensions for FCM, camera rendering, and dependency injection. ```bash dotnet add package RustPlusApi dotnet add package RustPlusApi.Fcm dotnet add package RustPlusApi.Fcm.Registration # native credentials (optional) dotnet add package RustPlusApi.Camera # camera rendering (optional) dotnet add package RustPlusApi.Extensions.DependencyInjection # DI registration (optional) dotnet add package RustPlusApi.Fcm.Extensions.DependencyInjection # DI registration for FCM (optional) ``` -------------------------------- ### Enable Console Logging for Rustplusapi Client Source: https://handys11.github.io/RustPlusApi/articles/logging.html Provide an ILoggerFactory to the Rustplus constructor to receive structured diagnostics. This example sets up console logging. ```csharp using Microsoft.Extensions.Logging; using var loggerFactory = LoggerFactory.Create(builder => builder.AddConsole()); using var rustPlus = new RustPlus( new RustPlusConnection("127.0.0.1", 28082, playerId, playerToken), loggerFactory: loggerFactory); ``` -------------------------------- ### Connect to Rust+ Server and Get Info Source: https://handys11.github.io/RustPlusApi/index.html This snippet demonstrates how to connect to a Rust+ server using the RustPlus client and retrieve basic server information. Ensure you have the necessary connection details (server, port, playerId, playerToken). ```csharp using RustPlusApi; using var rustPlus = new RustPlus(new RustPlusConnection(server, port, playerId, playerToken)); await rustPlus.ConnectAsync(); var info = await rustPlus.GetInfoAsync(); if (info.IsSuccess) Console.WriteLine($"{info.Data!.Name} — {info.Data.PlayerCount}/{info.Data.MaxPlayerCount}"); ``` -------------------------------- ### Run Mutation Testing Against a Project Source: https://handys11.github.io/RustPlusApi/development/testing.html Execute mutation testing for a specific project. Ensure you are in the test-project directory for correct configuration resolution. Multiple project examples are provided. ```bash cd tests/RustPlusApi.Fcm.UnitTests dotnet stryker --config-file stryker-config.json --project RustPlusApi.Fcm.csproj ``` ```bash cd tests/RustPlusApi.Fcm.Registration.UnitTests dotnet stryker --config-file stryker-config.json --project RustPlusApi.Fcm.Registration.csproj ``` ```bash cd tests/RustPlusApi.Camera.UnitTests dotnet stryker --config-file stryker-config.json --project RustPlusApi.Camera.csproj ``` ```bash cd tests/RustPlusApi.Extensions.DependencyInjection.UnitTests dotnet stryker --config-file stryker-config.json --project RustPlusApi.Extensions.DependencyInjection.csproj ``` ```bash cd tests/RustPlusApi.Fcm.Extensions.DependencyInjection.UnitTests dotnet stryker --config-file stryker-config.json --project RustPlusApi.Fcm.Extensions.DependencyInjection.csproj ``` -------------------------------- ### Get Server Info Async Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Interfaces.IRustPlus.html Obtains server metadata, including name, map, and player counts. No parameters are required. ```csharp Task> GetInfoAsync(CancellationToken cancellationToken = default) ``` -------------------------------- ### Firebase Installations URL Constant Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Fcm.Registration.RegistrationConstants.html The Firebase Installations Service (FIS) endpoint for the Rust Companion project. This is a constant value. ```csharp public const string FirebaseInstallationsUrl = "https://firebaseinstallations.googleapis.com/v1/projects/rust-companion-app/installations" ``` -------------------------------- ### Get Server Map Async Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Interfaces.IRustPlus.html Retrieves the server map image and a list of its monuments. No parameters are required. ```csharp Task> GetMapAsync(CancellationToken cancellationToken = default) ``` -------------------------------- ### Get Storage Monitor Info Async Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.RustPlus.html Retrieves the information of a storage monitor asynchronously. Requires the entity ID and a cancellation token. ```csharp public Task> GetStorageMonitorInfoAsync(ulong entityId, CancellationToken cancellationToken = default)__ ``` -------------------------------- ### Get Smart Switch Info Async Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.RustPlus.html Retrieves the information of a smart switch asynchronously. Requires the entity ID and a cancellation token. ```csharp public Task> GetSmartSwitchInfoAsync(ulong entityId, CancellationToken cancellationToken = default)__ ``` -------------------------------- ### Register RustPlus Client from Connection Object Source: https://handys11.github.io/RustPlusApi/api/Microsoft.Extensions.DependencyInjection.RustPlusServiceCollectionExtensions.html Registers a single configured IRustPlus client using a provided RustPlusConnection object. The client is registered as a container-disposed singleton and is not automatically connected. Call ConnectAsync when ready. Use this for direct connection setup. ```csharp public static IServiceCollection AddRustPlus(this IServiceCollection services, RustPlusConnection connection, Action? configureOptions = null) ``` -------------------------------- ### RegisterAsync Method Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Fcm.Registration.Steps.AndroidFcmRegister.html Completes the full FCM registration flow by running check-in, Firebase installation, and FCM registration. Returns the GCM identity and FCM token. ```csharp public Task<(Gcm Gcm, string FcmToken)> RegisterAsync(CancellationToken cancellationToken = default)__ ``` -------------------------------- ### Build and Serve Documentation Source: https://handys11.github.io/RustPlusApi/development/building-docs.html Builds the API metadata and site, then serves it with a live preview on localhost. Open http://localhost:8080 to view. ```bash docfx docs/docfx.json --serve ``` -------------------------------- ### Get Storage Monitor Info Async Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Interfaces.IRustPlus.html Fetches the current contents and protection state of a storage monitor. Requires the entity ID of the storage monitor. ```csharp Task> GetStorageMonitorInfoAsync(ulong entityId, CancellationToken cancellationToken = default) ``` -------------------------------- ### PlayerId Property Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.RustPlusSocket.html Gets the Steam ID for which requests are issued. ```csharp protected ulong PlayerId { get; } ``` -------------------------------- ### Construct and Connect RustPlus Client Source: https://handys11.github.io/RustPlusApi/articles/rustplus-client.html Instantiate the RustPlus client with connection details and establish an asynchronous connection to the server. Ensure you have the correct server IP, port, Player ID, and Player Token. ```csharp using var rustPlus = new RustPlus(new RustPlusConnection(server, port, playerId, playerToken, UseFacepunchProxy: false)); await rustPlus.ConnectAsync(); ``` -------------------------------- ### MessageData ProjectId Property Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Fcm.Data.MessageData.html Represents the Expo project GUID that routed this notification. ```csharp public Guid ProjectId { get; init; } ``` -------------------------------- ### RustPlus Constructor with Connection Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.RustPlus.html Initializes a new RustPlus instance, establishing a connection to a Rust+ server. Optional parameters allow for tuning connection options and integrating with a logging factory. ```csharp public RustPlus(RustPlusConnection connection, RustPlusSocketOptions? options = null, ILoggerFactory? loggerFactory = null) ``` -------------------------------- ### Get Clan Info Async Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.RustPlus.html Retrieves the clan information. Requires a cancellation token. ```csharp public Task> GetClanInfoAsync(CancellationToken cancellationToken = default)__ ``` -------------------------------- ### Build Documentation Only Source: https://handys11.github.io/RustPlusApi/development/building-docs.html Builds the documentation site without serving it. The output is placed in the gitignored `docs/_site/` directory. ```bash docfx docs/docfx.json ``` -------------------------------- ### Get Time Async Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.RustPlus.html Retrieves the current time information asynchronously. Requires a cancellation token. ```csharp public Task> GetTimeAsync(CancellationToken cancellationToken = default)__ ``` -------------------------------- ### Get Team Info Async Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.RustPlus.html Retrieves the team information asynchronously. Requires a cancellation token. ```csharp public Task> GetTeamInfoAsync(CancellationToken cancellationToken = default)__ ``` -------------------------------- ### Registering and Using RustPlus Client Factory Source: https://handys11.github.io/RustPlusApi/articles/dependency-injection.html Shows how to register the RustPlus client factory, which allows creating clients at runtime. Factory-created clients are caller-owned and must be explicitly disposed, preferably using 'await using'. ```csharp services.AddRustPlusFactory(); // later, when the connection is known: var factory = provider.GetRequiredService(); await using var client = factory.Create(connection); await client.ConnectAsync(); ``` -------------------------------- ### Get Map Markers Async Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.RustPlus.html Retrieves the map markers for the server. Requires a cancellation token. ```csharp public Task> GetMapMarkersAsync(CancellationToken cancellationToken = default)__ ``` -------------------------------- ### Camera Subscription and Data Handling Source: https://handys11.github.io/RustPlusApi/articles/cameras.html Demonstrates how to subscribe to a camera, handle incoming frames, and unsubscribe. ```APIDOC ## Subscribe to Camera ### Description Subscribes to a specific camera to receive its feed and information. ### Method `rustPlus.SubscribeToCameraAsync(string cameraId)` ### Parameters #### Path Parameters - **cameraId** (string) - Required - The unique identifier of the camera to subscribe to. ### Response #### Success Response (Response) - **IsSuccess** (bool) - Indicates if the subscription was successful. - **Value** (CameraInfo?) - Contains camera information if successful, otherwise null. ### `CameraInfo` Properties - **Width** (int) - Render width in pixels. - **Height** (int) - Render height in pixels. - **NearPlane** (float) - Near clip-plane distance. - **FarPlane** (float) - Far clip-plane distance (maximum ray-cast range). - **ControlFlags** (CameraControlFlags) - Bitmask of inputs the camera accepts. ### `CameraControlFlags` Values - **None** (0) - No controls available. - **Movement** (1) - WASD movement is supported. - **Mouse** (2) - Mouse look is supported. - **SprintAndDuck** (4) - Sprint and duck inputs are supported. - **Fire** (8) - Fire inputs are supported. - **Reload** (16) - Reload input is supported. - **Crosshair** (32) - The camera renders a crosshair overlay. ## Camera Frame Data ### Description Callback for receiving camera frame data, including field of view, ray data, and entities. ### Event `rustPlus.OnCameraRaysReceived += (_, frame) => { ... }` ### `CameraFrame` Fields - **VerticalFov** (float) - Vertical field-of-view in degrees. - **SampleOffset** (int) - Index into the shuffled sample-position buffer. - **RayData** (byte[]) - Run-length-encoded depth/material bytes. - **Distance** (float) - Maximum ray-cast distance used when encoding the frame. - **Entities** (List) - List of CameraEntity objects visible in the frame. - **TimeOfDay** (float?) - In-game time of day when captured. - **CameraPosition** (Vector3?) - World-space position of the camera. - **CameraRotation** (Quaternion?) - World-space rotation of the camera. ## Unsubscribe from Camera ### Description Unsubscribes from the current camera feed. ### Method `rustPlus.UnsubscribeFromCameraAsync()` ### Parameters None ``` -------------------------------- ### Get Server Map Async Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.RustPlus.html Retrieves the server map data. Requires a cancellation token. ```csharp public Task> GetMapAsync(CancellationToken cancellationToken = default)__ ``` -------------------------------- ### Run RustPlus Camera App (Interactive) Source: https://handys11.github.io/RustPlusApi/articles/samples.html Enables interactive viewing and control of server cameras. It prompts for a camera identifier and supports live ASCII preview, image saving, PTZ control, and shooting. ```bash dotnet run --project samples/RustPlus.Camera.ConsoleApp ``` -------------------------------- ### Build RustPlusApi.NetFrameworkSmoke Project Source: https://handys11.github.io/RustPlusApi/development/testing.html Use this command to explicitly build the RustPlusApi.NetFrameworkSmoke project. This verifies that the public API surface is reachable from a .NET Framework 4.8 consumer. ```bash dotnet build tests/RustPlusApi.NetFrameworkSmoke/RustPlusApi.NetFrameworkSmoke.csproj ``` -------------------------------- ### Get Clan Chat Async Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.RustPlus.html Retrieves the clan chat information. Requires a cancellation token. ```csharp public Task> GetClanChatAsync(CancellationToken cancellationToken = default)__ ``` -------------------------------- ### Get Clan Chat Async Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Interfaces.IRustPlus.html Fetches recent messages from the clan chat. No parameters are required. ```csharp Task> GetClanChatAsync(CancellationToken cancellationToken = default) ``` -------------------------------- ### Run RustPlus Camera App (Headless Capture) Source: https://handys11.github.io/RustPlusApi/articles/samples.html Captures camera data in a headless mode for generating render fixtures. It outputs a JSON frame dump and a PNG image, requiring camera ID and duration as parameters. ```bash dotnet run --project samples/RustPlus.Camera.ConsoleApp -- [credentialsPath] capture [outputDir] ``` -------------------------------- ### IsConnected Property Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.RustPlusSocket.html Gets a value indicating whether the client is currently connected to the Rust+ socket. ```APIDOC ## IsConnected ### Description Gets a value indicating whether the client is currently connected to the Rust+ socket (the underlying WebSocket is open). ### Property Value - **bool** ``` -------------------------------- ### LoginAsync Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Fcm.Registration.Steps.SteamLoginService.html Launches Chrome, navigates to the Facepunch Steam login page, and returns the captured auth token. ```APIDOC ## LoginAsync(CancellationToken cancellationToken = default) ### Description Launches Chrome, navigates to the Facepunch Steam login page, and returns the captured auth token. ### Parameters #### Parameters - **cancellationToken** (CancellationToken) - Optional - Token to cancel the operation. ### Returns Task - The captured Rust+ auth token. ### Exceptions #### Exceptions - **OperationCanceledException** - Thrown when `cancellationToken` is cancelled before a token is received. ``` -------------------------------- ### Capture Camera Snapshot Source: https://handys11.github.io/RustPlusApi/articles/recipes.html Use CameraController to subscribe to a camera, accumulate frames with CameraRenderer, render a PNG, and save it. Requires the RustPlusApi.Camera NuGet package. The session is automatically disposed when the 'using' block exits. ```csharp using RustPlusApi; using RustPlusApi.Camera; const string ServerIp = "192.0.2.1"; const int ServerPort = 28082; const ulong PlayerId = 76561198000000000UL; const int PlayerToken = -123456789; const string CameraId = "CAM01"; // in-game identifier set on the computer station const int FrameTarget = 10; // accumulate 10 frames before saving using var rustPlus = new RustPlus(new RustPlusConnection(ServerIp, ServerPort, PlayerId, PlayerToken)); await rustPlus.ConnectAsync(); var session = await CameraController.SubscribeAsync(rustPlus, CameraId); if (!session.IsSuccess) { Console.Error.WriteLine($"Subscribe failed: {session.Error?.Code} {session.Error?.Message}"); return; } await using var camera = session.Data!; // DisposeAsync stops the keep-alive and unsubscribes var renderer = new CameraRenderer(camera.Info.Width, camera.Info.Height); var tcs = new TaskCompletionSource(); var frameCount = 0; camera.OnFrameReceived += async (_, frame) => { renderer.AddRays(frame); if (++frameCount < FrameTarget) return; // Enough frames — render and save. var png = renderer.Render(); await File.WriteAllBytesAsync("snapshot.png", png); Console.WriteLine($"Saved snapshot.png ({png.Length:N0} bytes) after {frameCount} frames."); tcs.TrySetResult(true); }; await tcs.Task; // wait until the snapshot is saved ``` -------------------------------- ### IsConnected Property Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.RustPlusSocket.html Gets a value indicating whether the client is currently connected to the Rust+ socket. ```csharp public bool IsConnected { get; } ``` -------------------------------- ### Notification ServerId Property Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Fcm.Data.Notification-1.html Stores the Rust+ server ID to which the notification is associated. This is a Guid value. ```csharp public Guid ServerId { get; init; } ``` -------------------------------- ### Body.Id Property Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Fcm.Data.Body.html Represents the unique Rust+ server ID. This property holds a Guid value. ```csharp public Guid Id { get; init; } ``` -------------------------------- ### RegisterFcmAsync Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Fcm.Registration.Steps.AndroidFcmRegister.html Performs the final FCM registration step using the GCM identity and Firebase installation token. ```APIDOC ## RegisterFcmAsync(Gcm gcm, string firebaseInstallationToken, CancellationToken cancellationToken) ### Description Step 3 — FCM register (c2dm/register3), returning the FCM token. ### Parameters #### Parameters - `gcm` Gcm - GCM identity obtained from CheckInAsync(Gcm?, CancellationToken). - `firebaseInstallationToken` string - Firebase installation auth token from InstallAsync(CancellationToken). - `cancellationToken` CancellationToken - Token to cancel the operation. ### Returns Task #### Exceptions InvalidOperationException - Thrown when FCM registration fails after multiple attempts. ``` -------------------------------- ### Registering a Single RustPlus Client Source: https://handys11.github.io/RustPlusApi/articles/dependency-injection.html Demonstrates three ways to register a single RustPlus client: explicitly with connection details, by binding to configuration, or by resolving connection details from a service provider. The client is registered as a singleton and disposed by the container. ```csharp // explicit connection services.AddRustPlus(new RustPlusConnection("12.34.56.78", 28082, playerId, playerToken)); // or bound from configuration (keys: Server, Port, PlayerId, PlayerToken, UseFacepunchProxy) services.AddRustPlus(configuration.GetSection("Rust")); // or resolved from the provider services.AddRustPlus(sp => BuildConnection(sp), o => o.RequestTimeout = TimeSpan.FromSeconds(10)); ``` -------------------------------- ### Get Team Chat Async Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.RustPlus.html Retrieves the team chat information asynchronously. Requires a cancellation token. ```csharp public Task> GetTeamChatAsync(CancellationToken cancellationToken = default)__ ``` -------------------------------- ### Acquire and Register Rust+ Credentials Source: https://handys11.github.io/RustPlusApi/articles/credentials.html Orchestrates the entire credential acquisition and registration flow, from GCM check-in to Rust+ companion device registration. Persists credentials for future use and prepares for server pairing. ```csharp using RustPlusApi.Fcm.Registration; var registration = new FcmRegistration(); // Steps 1–4: GCM check-in → Firebase install → FCM register → Expo token. var credentials = await registration.AcquireCredentialsAsync(); // Steps 5–6: interactive Steam login (launches Chrome) + Rust Companion device registration. await registration.RegisterWithRustPlusAsync(credentials); // Step 7: persist for later runs. CredentialsStore.Save("rustplus.config.json", credentials); // Step 8: pair in game; one await yields the RustPlus constructor args. using var listener = new PairingListener(credentials); ServerPairing pairing = await listener.WaitForServerPairingAsync(); // new RustPlus(new RustPlusConnection(pairing.Ip, pairing.Port, pairing.PlayerId, pairing.PlayerToken)) ``` -------------------------------- ### Get Alarm Info Async Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.RustPlus.html Retrieves information about a specific alarm. Requires the entity ID and a cancellation token. ```csharp public Task> GetAlarmInfoAsync(ulong entityId, CancellationToken cancellationToken = default)__ ``` -------------------------------- ### Get Team Chat Messages Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Interfaces.IRustPlus.html Retrieves recent team chat messages. Requires a CancellationToken for asynchronous operations. ```csharp Task> GetTeamChatAsync(CancellationToken cancellationToken = default)__ ``` -------------------------------- ### LoginAsync Method Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Fcm.Registration.Steps.SteamLoginService.html Launches Chrome, navigates to the Facepunch Steam login page, and returns the captured auth token. The operation can be cancelled via the provided CancellationToken. ```csharp public Task LoginAsync(CancellationToken cancellationToken = default) ``` -------------------------------- ### RustCompanionClient Constructor Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Fcm.Registration.Steps.RustCompanionClient.html Initializes a new instance of the RustCompanionClient class. An optional HttpClient can be provided; otherwise, a new instance is created. ```APIDOC ## RustCompanionClient(HttpClient? httpClient = null) ### Description Initializes a new instance of the RustCompanionClient class. This client is used to interact with the Rust Companion API for device registration. ### Parameters #### Parameters - **httpClient** (HttpClient) - Optional - An HttpClient instance to use for network requests. If null, a new instance will be created internally. ``` -------------------------------- ### Get Clan Info Async Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Interfaces.IRustPlus.html Retrieves a full snapshot of the authenticated player's clan. No parameters are required. ```csharp Task> GetClanInfoAsync(CancellationToken cancellationToken = default) ``` -------------------------------- ### UseFacepunchProxy Property Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.RustPlusConnection.html Gets or initializes a boolean value specifying whether to use the Facepunch proxy. Defaults to false. ```csharp public bool UseFacepunchProxy { get; init; } ``` -------------------------------- ### RustCompanionClient Constructor Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Fcm.Registration.Steps.RustCompanionClient.html Initializes a new instance of the RustCompanionClient class. An optional HttpClient can be provided; otherwise, a new instance is created. This constructor is used to set up the client for interacting with the Rust Companion API. ```csharp public RustCompanionClient(HttpClient? httpClient = null) ``` -------------------------------- ### ToTravellingVendorMarker Extension Method Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Extensions.AppMarkerToModel.html Maps a protobuf AppMarker to a TravellingVendorMarker. Use this for travelling vendor markers. ```csharp public static TravellingVendorMarker ToTravellingVendorMarker(this AppMarker marker) ``` -------------------------------- ### Server Property Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.RustPlusConnection.html Gets or initializes the IP address of the Rust+ server. This property specifies the server endpoint for the connection. ```csharp public string Server { get; init; } ``` -------------------------------- ### ToEntityId Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Fcm.Extensions.BodyToEventModel.html Extracts the entity ID from the notification body. This is a convenient way to get a specific entity's identifier. ```APIDOC ## ToEntityId(Body) ### Description Extracts the entity ID from the notification body. ### Method Extension Method ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response - **int?** - The extracted entity ID, or null if not found. #### Response Example None ``` -------------------------------- ### Run Tests with Coverage Analysis Source: https://handys11.github.io/RustPlusApi/development/testing.html Execute tests and generate coverage reports. Requires a runsettings file and specifies a directory for results. Use the `--settings` and `--results-directory` options. ```bash dotnet test RustPlusApi.sln \ --settings tests/RustPlusApi.UnitTests/coverlet.runsettings \ --results-directory ./TestResults ``` -------------------------------- ### LookAsync Method Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Camera.CameraController.html Turns the camera by sending a single mouse-delta frame. This method is applicable to PTZ cameras, turrets, and drones. It may be refused with NotSupported if the device does not support mouse look. ```csharp public Task LookAsync(float deltaX, float deltaY, CancellationToken cancellationToken = default) ``` -------------------------------- ### CameraInfo.NearPlane Property Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Data.Cameras.CameraInfo.html Gets the near clip-plane distance. This property defines the minimum distance at which objects are rendered by the camera. ```csharp public float NearPlane { get; init; } ``` -------------------------------- ### Run RustPlus Console App Source: https://handys11.github.io/RustPlusApi/articles/samples.html Provides an interactive menu to query and control server features like server info, team management, clan management, and electricity controls. Requires credentials to be configured. ```bash # Copy credentials.sample.json to credentials.json and fill in the values # printed by the Register app (ip / port / playerId / playerToken), then: dotnet run --project samples/RustPlus.ConsoleApp # or pass the path explicitly: dotnet run --project samples/RustPlus.ConsoleApp -- /path/to/credentials.json ``` -------------------------------- ### CameraInfo.ControlFlags Property Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Data.Cameras.CameraInfo.html Gets the bitmask of inputs the camera accepts. This property indicates which control functionalities are available for the camera. ```csharp public CameraControlFlags ControlFlags { get; init; } ``` -------------------------------- ### RustPlus Constructor Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.RustPlus.html Initializes a new instance of the RustPlus class, connecting to a Rust+ server using the specified parameters. This constructor sets up the connection with server details and optional configuration for socket behavior and logging. ```APIDOC ## RustPlus Constructor ### Description Initializes a new instance of the RustPlus class, connecting to a Rust+ server using the specified parameters. ### Method Constructor ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **connection** (RustPlusConnection) - Required - The server endpoint and player credentials to connect as. - **options** (RustPlusSocketOptions?) - Optional - Tuning options (timeouts, keep-alive, buffer size); defaults are used when null. - **loggerFactory** (ILoggerFactory?) - Optional - Routes the client's diagnostics into your logging stack; logging is disabled (a no-op `NullLogger`) when null. ### Request Example None ### Response None See Also RustPlusSocket ``` -------------------------------- ### BuildAckOutput Method Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Utils.ResponseHelper.html Use this method to create a Response object for commands that only need to acknowledge success or failure without returning specific data. It accepts a boolean indicating success and an optional message. ```csharp public static Response BuildAckOutput(bool isSuccess, string? message = null) ``` -------------------------------- ### Get Game Time Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Interfaces.IRustPlus.html Retrieves the current in-game time and day/night cycle parameters. Supports cancellation via CancellationToken. ```csharp Task> GetTimeAsync(CancellationToken cancellationToken = default)__ ``` -------------------------------- ### ToPlayerMarker Extension Method Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Extensions.AppMarkerToModel.html Maps a protobuf AppMarker to a PlayerMarker. Use this for player-specific markers. ```csharp public static PlayerMarker ToPlayerMarker(this AppMarker marker) ``` -------------------------------- ### ToVendingMachineItem Extension Method Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Extensions.AppMarkerToModel.html Maps a protobuf AppMarker.SellOrder to a VendingMachineItem. Use this for individual sell orders. ```csharp public static VendingMachineItem ToVendingMachineItem(this AppMarker.SellOrder sellOrder) ``` -------------------------------- ### Get Alarm Info Async Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Interfaces.IRustPlus.html Retrieves the current state of a smart alarm entity. Requires the entity ID of the alarm. ```csharp Task> GetAlarmInfoAsync(ulong entityId, CancellationToken cancellationToken = default) ``` -------------------------------- ### PlayerNote Icon Property Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Data.Notes.PlayerNote.html Represents the icon displayed on the note. Use this property to get or set the icon for a player note. ```csharp public NoteIcons Icon { get; init; } ``` -------------------------------- ### PlayerNote Color Property Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Data.Notes.PlayerNote.html Represents the color of the note icon. Use this property to get or set the color of a player note. ```csharp public NoteColors Color { get; init; } ``` -------------------------------- ### RustPlusConnection Constructor Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.RustPlusConnection.html Initializes a new instance of the RustPlusConnection class with server details and player credentials. Use this constructor to set up the connection identity for a RustPlus client. ```csharp public RustPlusConnection(string Server, int Port, ulong PlayerId, int PlayerToken, bool UseFacepunchProxy = false) ``` -------------------------------- ### CameraInfo.Width Property Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Data.Cameras.CameraInfo.html Gets the render width of the camera in pixels. This property defines the horizontal resolution of the camera's output. ```csharp public int Width { get; init; } ``` -------------------------------- ### ShootAsync Method Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Camera.CameraController.html Fires an auto-turret once. This method is refused with NotSupported unless the camera is an auto-turret. ```csharp public Task ShootAsync(CancellationToken cancellationToken = default)__ ``` -------------------------------- ### CameraInfo.Height Property Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Data.Cameras.CameraInfo.html Gets the render height of the camera in pixels. This property defines the vertical resolution of the camera's output. ```csharp public int Height { get; init; } ``` -------------------------------- ### ToTravellingVendorMarker Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Extensions.AppMarkerToModel.html Maps a protobuf AppMarker to a TravellingVendorMarker model. ```APIDOC ## ToTravellingVendorMarker(AppMarker) ### Description Maps a marker to a TravellingVendorMarker. ### Method Extension Method ### Parameters #### Path Parameters - **marker** (AppMarker) - Required - The protobuf map marker. ### Returns TravellingVendorMarker ``` -------------------------------- ### RustPlusConnection Constructor Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.RustPlusConnection.html Initializes a new instance of the RustPlusConnection class with the specified server endpoint and player credentials. ```APIDOC ## RustPlusConnection(string Server, int Port, ulong PlayerId, int PlayerToken, bool UseFacepunchProxy = false) ### Description Connection identity for a RustPlus client: the server endpoint and the player credentials a request is issued as. Grouping these into one value keeps the RustPlus constructor readable at the call site. ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Constructor Signature `public RustPlusConnection(string Server, int Port, ulong PlayerId, int PlayerToken, bool UseFacepunchProxy = false)` #### Parameters - **Server** (string) - Required - The IP address of the Rust+ server. - **Port** (int) - Required - The port dedicated for the Rust+ companion app (not the one used to connect in-game). - **PlayerId** (ulong) - Required - Your Steam ID. - **PlayerToken** (int) - Required - Your player token acquired with FCM. - **UseFacepunchProxy** (bool) - Optional - Specifies whether to use the Facepunch proxy. ``` -------------------------------- ### SteamLoginService Constructor Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Fcm.Registration.Steps.SteamLoginService.html Initializes a new instance of the SteamLoginService class. It launches Chrome/Chromium with DevTools protocol enabled and captures the Rust+ auth token. Chrome/Chromium is required. ```csharp public SteamLoginService(int port = 3000) ``` -------------------------------- ### Map multiple storage items to StorageMonitorItemInfo Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Extensions.AppEntityInfoToModel.html Converts a sequence of protobuf storage items to a collection of StorageMonitorItemInfo models. ```csharp public static IEnumerable ToStorageMonitorItemsInfo(this IEnumerable items) ``` -------------------------------- ### Get Team Information Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Interfaces.IRustPlus.html Fetches the complete team snapshot, including member statuses and map notes. Uses CancellationToken for cancellation. ```csharp Task> GetTeamInfoAsync(CancellationToken cancellationToken = default)__ ``` -------------------------------- ### Register RustPlus Client from Configuration Source: https://handys11.github.io/RustPlusApi/api/Microsoft.Extensions.DependencyInjection.RustPlusServiceCollectionExtensions.html Registers a single configured IRustPlus client using settings from an IConfiguration section. The client is registered as a container-disposed singleton. Use this when connection details are stored in configuration. ```csharp public static IServiceCollection AddRustPlus(this IServiceCollection services, IConfiguration connectionSection, Action? configureOptions = null) ``` -------------------------------- ### Get Nexus Auth Async Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Interfaces.IRustPlus.html Obtains a Nexus cross-server authentication token. Requires an application key for the target Nexus server. ```csharp Task> GetNexusAuthAsync(string appKey, CancellationToken cancellationToken = default) ``` -------------------------------- ### ToVendingMachineMarker Extension Method Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Extensions.AppMarkerToModel.html Maps a protobuf AppMarker to a VendingMachineMarker, including its sell orders. Use this for vending machine markers. ```csharp public static VendingMachineMarker ToVendingMachineMarker(this AppMarker marker) ``` -------------------------------- ### Get Nexus Authentication Source: https://handys11.github.io/RustPlusApi/articles/clan-and-nexus.html Retrieves Nexus authentication details, including the server ID and player token, required for cross-server communication. ```csharp var nexus = await rustPlus.GetNexusAuthAsync(appKey); // Response if (nexus.IsSuccess) Console.WriteLine($"{nexus.Data!.ServerId} / {nexus.Data.PlayerToken}"); ``` -------------------------------- ### RustPlusSocket Constructor Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.RustPlusSocket.html Initializes a new instance of the RustPlusSocket class with the specified connection, options, and logger factory. ```APIDOC ## RustPlusSocket(RustPlusConnection, RustPlusSocketOptions?, ILoggerFactory?) ### Description Initializes a new instance of the RustPlusSocket class with the specified connection, options, and logger factory. ### Parameters #### Parameters - **connection** (RustPlusConnection) - Required - The server endpoint and player credentials to connect as. - **options** (RustPlusSocketOptions) - Optional - Tuning options (timeouts, keep-alive, buffer size); defaults are used when null. - **loggerFactory** (ILoggerFactory) - Optional - Routes the client's diagnostics into your logging stack; logging is disabled (a no-op `NullLogger`) when null. ``` -------------------------------- ### Get Smart Switch Info Async Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Interfaces.IRustPlus.html Retrieves the current state of a smart switch entity. Requires the entity ID of the smart switch. ```csharp Task> GetSmartSwitchInfoAsync(ulong entityId, CancellationToken cancellationToken = default) ``` -------------------------------- ### RegisterAsync Method Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Fcm.Registration.Steps.RustCompanionClient.html Subscribes the device to pairing pushes by registering it with the Rust Companion API. Requires a Steam authentication token, an Expo push token, and an optional device ID. A CancellationToken can be used to cancel the operation. ```csharp public Task RegisterAsync(string steamAuthToken, string expoPushToken, string deviceId = "RustPlusApi", CancellationToken cancellationToken = default) ``` -------------------------------- ### ToServerInfo Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Extensions.AppInfoToModel.html Maps a RustPlusContracts.AppInfo object to a ServerInfo object. This is a static extension method on the AppInfo class. ```APIDOC ## ToServerInfo(AppInfo) ### Description Maps an RustPlusContracts.AppInfo to a ServerInfo. ### Method static extension ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters `appInfo` AppInfo - Required - The protobuf server info response. ### Returns ServerInfo - The mapped ServerInfo object. ``` -------------------------------- ### Subscribe to Camera Stream Asynchronously Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.RustPlus.html Subscribes to a camera feed asynchronously to start receiving camera rays. Requires a camera ID for identification. ```csharp public Task> SubscribeToCameraAsync(string cameraId, CancellationToken cancellationToken = default) ``` -------------------------------- ### Run All Tests Source: https://handys11.github.io/RustPlusApi/development/testing.html Execute all tests across both target frameworks (`netstandard2.0` and `net10.0`). ```bash dotnet test RustPlusApi.sln ``` -------------------------------- ### RegisterAsync Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Fcm.Registration.Steps.AndroidFcmRegister.html Executes the complete registration flow, including GCM check-in, Firebase installation, and FCM registration, returning both the GCM identity and the FCM token. ```APIDOC ## RegisterAsync(CancellationToken cancellationToken) ### Description Runs check-in + FIS + FCM register and returns the GCM identity and FCM token. ### Parameters #### Parameters - `cancellationToken` CancellationToken - Token to cancel the operation. ### Returns Task<(Gcm Gcm, string FcmToken)> ``` -------------------------------- ### Map Protobuf CameraRays to CameraFrame Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Extensions.AppCameraToModel.html Converts a RustPlusContracts.AppCameraRays broadcast into a CameraFrame object. Use this to transform raw camera ray data into a usable frame representation. ```csharp public static CameraFrame ToCameraFrame(this AppCameraRays appCameraRays) ``` -------------------------------- ### Get Entity Info Async Generic Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.RustPlus.html Retrieves information for a generic entity type. Requires the entity ID, a selector function, and a cancellation token. ```csharp protected Task> GetEntityInfoAsync(ulong entityId, Func selector, CancellationToken cancellationToken = default)__ ``` -------------------------------- ### Obtain Fresh Player Token After Re-pairing Source: https://handys11.github.io/RustPlusApi/articles/troubleshooting.html Use this code to re-pair your server and obtain a new player token when existing tokens become invalid. Ensure you have the `CredentialsStore` and `PairingListener` classes available. ```csharp var creds = CredentialsStore.Load("rustplus.config.json"); using var pairingListener = new PairingListener(creds); var pairing = await pairingListener.WaitForServerPairingAsync(); // pairing.PlayerToken is the fresh token — use it going forward. ``` -------------------------------- ### RustPlusSocket Constructor Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.RustPlusSocket.html Initializes a new instance of the RustPlusSocket class with specified connection, options, and logger factory. ```csharp protected RustPlusSocket(RustPlusConnection connection, RustPlusSocketOptions? options = null, ILoggerFactory? loggerFactory = null) ``` -------------------------------- ### Subscribe to Camera Async Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Interfaces.IRustPlus.html Subscribes to a camera's ray stream to receive its information. Requires the camera's in-game identifier. ```csharp Task> SubscribeToCameraAsync(string cameraId, CancellationToken cancellationToken = default)__ ``` -------------------------------- ### Get Map Markers Async Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Interfaces.IRustPlus.html Fetches all current map markers, such as player positions, cargo ship locations, and vending machines. No parameters are required. ```csharp Task> GetMapMarkersAsync(CancellationToken cancellationToken = default) ``` -------------------------------- ### Map AppMap to ServerMap Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Extensions.AppMapToModel.html Use this extension method to map a protobuf AppMap object to a ServerMap model. This is the primary entry point for converting the entire map data. ```csharp public static ServerMap ToServerMap(this AppMap appMap) ``` -------------------------------- ### CameraInfo.FarPlane Property Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Data.Cameras.CameraInfo.html Gets the far clip-plane distance, representing the maximum ray cast range for the camera. This is useful for determining the effective rendering distance. ```csharp public float FarPlane { get; init; } ``` -------------------------------- ### Map single storage item to StorageMonitorItemInfo Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Extensions.AppEntityInfoToModel.html Converts a single protobuf storage item (AppEntityPayload.Item) to a StorageMonitorItemInfo model. ```csharp public static StorageMonitorItemInfo ToStorageMonitorItemInfo(this AppEntityPayload.Item item) ``` -------------------------------- ### RegisterAsync Method Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Fcm.Registration.Steps.RustCompanionClient.html Registers the device with the Rust Companion API by subscribing it to pairing pushes. This method requires a Steam authentication token and an Expo push token. ```APIDOC ## RegisterAsync(string steamAuthToken, string expoPushToken, string deviceId = "RustPlusApi", CancellationToken cancellationToken = default) ### Description Subscribes the device to pairing pushes with the Rust Companion API. This is a crucial step for receiving notifications and maintaining the device registration. ### Parameters #### Parameters - **steamAuthToken** (string) - Required - The Steam authentication token obtained from SteamLoginService. - **expoPushToken** (string) - Required - The Expo push token obtained from ExpoPushClient, used to identify the device for push notifications. - **deviceId** (string) - Optional - An arbitrary identifier for the device. Defaults to "RustPlusApi". - **cancellationToken** (CancellationToken) - Optional - A token to cancel the asynchronous operation. ### Returns Task - Represents the asynchronous operation of registering the device. ``` -------------------------------- ### Set CHROME_PATH Environment Variable Source: https://handys11.github.io/RustPlusApi/articles/troubleshooting.html If Chrome or Chromium is not found automatically, you can specify its path using the CHROME_PATH environment variable. This is useful for custom installations or non-standard locations. ```bash export CHROME_PATH=/usr/bin/chromium dotnet run --project samples/RustPlus.Register.ConsoleApp ``` -------------------------------- ### AddRustPlus(IServiceCollection, RustPlusConnection, Action?) Source: https://handys11.github.io/RustPlusApi/api/Microsoft.Extensions.DependencyInjection.RustPlusServiceCollectionExtensions.html Registers a single configured IRustPlus client as a container-disposed singleton. The client is not connected initially; `ConnectAsync` must be called when ready. Supports optional tuning of RustPlusSocketOptions. This method is a no-op if an IRustPlus client is already registered. ```APIDOC ## AddRustPlus(IServiceCollection, RustPlusConnection, Action?) ### Description Registers a single configured IRustPlus client as a container-disposed singleton. The client is not connected; call `ConnectAsync` when ready. ### Method `public static IServiceCollection AddRustPlus(this IServiceCollection services, RustPlusConnection connection, Action? configureOptions = null)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response Returns the same `services` collection for chaining. #### Response Example None #### Remarks No-op if an IRustPlus is already registered (first registration wins); `configureOptions` delegates always compose regardless. #### Exceptions - `ArgumentNullException`: Thrown when `services` or `connection` is null. ``` -------------------------------- ### AcquireCredentialsAsync Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Fcm.Registration.FcmRegistration.html Performs steps 1–4: GCM check-in, Firebase install, FCM register, and Expo token acquisition. Returns the Credentials the FCM listener needs. ```APIDOC ## AcquireCredentialsAsync(CancellationToken) ### Description Steps 1–4: GCM check-in, Firebase install, FCM register and Expo token. Returns the Credentials the FCM listener needs (GCM identity + FCM + Expo tokens). ### Parameters - **cancellationToken** (CancellationToken) - Token to cancel the operation. ### Returns Task - The acquired credentials. ``` -------------------------------- ### AddRustPlusFactory(IServiceCollection, Action?) Source: https://handys11.github.io/RustPlusApi/api/Microsoft.Extensions.DependencyInjection.RustPlusServiceCollectionExtensions.html Registers a singleton IRustPlusFactory that creates caller-owned IRustPlus clients for connections known only at runtime. The host's ILoggerFactory and configured RustPlusSocketOptions are used for each client. Supports optional tuning of RustPlusSocketOptions. This method is a no-op if an IRustPlusFactory is already registered. ```APIDOC ## AddRustPlusFactory(IServiceCollection, Action?) ### Description Registers a singleton IRustPlusFactory creating caller-owned IRustPlus clients for connections known only at runtime. The host's ILoggerFactory (when registered) and the configured RustPlusSocketOptions are wired into every client. ### Method `public static IServiceCollection AddRustPlusFactory(this IServiceCollection services, Action? configureOptions = null)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response Returns the same `services` collection for chaining. #### Response Example None #### Remarks No-op if an IRustPlusFactory is already registered (first registration wins); `configureOptions` delegates always compose regardless. #### Exceptions - `ArgumentNullException`: Thrown when `services` is null. ``` -------------------------------- ### Get MCS Protocol Tag from Protobuf Type Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Fcm.Utils.McsUtils.html Retrieves the MCS protocol tag corresponding to a given CLR protobuf message type. Throws ArgumentOutOfRangeException if the type is not recognized. ```csharp public static Tags.McsProtoTag GetTagFromProtobufType(Type type) ``` -------------------------------- ### AcquireCredentialsAsync Method Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Fcm.Registration.FcmRegistration.html Acquires necessary credentials including GCM check-in, Firebase installation, FCM registration, and Expo token. This method is crucial for obtaining the tokens needed for the FCM listener. ```csharp public Task AcquireCredentialsAsync(CancellationToken cancellationToken = default)__ ``` -------------------------------- ### Map Protobuf Camera Entities to CameraEntity Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Extensions.AppCameraToModel.html Converts a collection of protobuf camera entities to a sequence of CameraEntity instances. Use this when processing camera data received from the Rust+ API. ```csharp public static IEnumerable ToCameraEntities(this IEnumerable entities) ``` -------------------------------- ### ToVendingMachineItems Extension Method Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Extensions.AppMarkerToModel.html Maps a sequence of protobuf AppMarker.SellOrder objects to VendingMachineItem instances. Use this for multiple sell orders. ```csharp public static IEnumerable ToVendingMachineItems(this IEnumerable sellOrders) ``` -------------------------------- ### RegisterFcmAsync Method Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Fcm.Registration.Steps.AndroidFcmRegister.html Performs the final FCM registration step using the GCM identity and Firebase installation token. Returns the FCM token. Throws an InvalidOperationException if registration fails after multiple attempts. ```csharp public Task RegisterFcmAsync(Gcm gcm, string firebaseInstallationToken, CancellationToken cancellationToken = default)__ ``` -------------------------------- ### Get Clan Info and Send Message Source: https://handys11.github.io/RustPlusApi/articles/clan-and-nexus.html Retrieves clan information, including members and roles, and allows setting the clan MOTD and sending chat messages. Handles potential null data for clan members. ```csharp var clan = await rustPlus.GetClanInfoAsync(); // Response if (clan.IsSuccess) { Console.WriteLine(clan.Data!.Name); foreach (var member in clan.Data.Members ?? []) Console.WriteLine($" {member.SteamId} (role {member.RoleId})"); } await rustPlus.SetClanMotdAsync("Welcome to the clan!"); var chat = await rustPlus.GetClanChatAsync(); // Response await rustPlus.SendClanMessageAsync("gg"); ``` -------------------------------- ### ToSubscriptionInfo Extension Method Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Extensions.AppFlagToModel.html Maps an RustPlusContracts.AppFlag protobuf object to a SubscriptionInfo model. This method is an extension to the AppFlag type. ```csharp public static SubscriptionInfo ToSubscriptionInfo(this AppFlag flag)__ ``` -------------------------------- ### ToTimeInfo(AppTime) Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Extensions.AppTimeToModel.html Maps an RustPlusContracts.AppTime to a TimeInfo. This is a static extension method. ```APIDOC ## ToTimeInfo(AppTime) ### Description Maps an RustPlusContracts.AppTime to a TimeInfo. This is a static extension method. ### Method static extension ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters `appTime` AppTime - The protobuf time response. ### Returns TimeInfo - The mapped TimeInfo object. ``` -------------------------------- ### Connect to FCM MCS Server Source: https://handys11.github.io/RustPlusApi/api/RustPlusApi.Fcm.RustPlusFcmSocket.html Connects to the FCM MCS server over TLS and initiates the login handshake. This method starts a background loop for receiving messages. Instances are single-connection and require a new instance to reconnect after disconnection or disposal. ```csharp [ExcludeFromCodeCoverage] public Task ConnectAsync(CancellationToken cancellationToken = default)__ ``` -------------------------------- ### Camera Methods Source: https://handys11.github.io/RustPlusApi/articles/rustplus-client.html Methods for subscribing to and interacting with in-game cameras. ```APIDOC ## SubscribeToCameraAsync ### Description Starts streaming camera rays for a specific camera. Returns the camera's width, height, and flags. ### Method POST ### Endpoint /camera/{cameraId}/subscribe ### Parameters #### Path Parameters - **cameraId** (string) - Required - The ID of the camera to subscribe to. ### Response #### Success Response (200) - **cameraInfo** (CameraInfo?) - Object containing camera resolution and flags. ### Response Example ```json { "cameraInfo": { "width": 1920, "height": 1080, "flags": 0 } } ``` ## SendCameraInputAsync ### Description Sends movement and action input to the currently subscribed camera. ### Method POST ### Endpoint /camera/input ### Parameters #### Request Body - **buttons** (integer) - Required - Bitmask representing button inputs (e.g., movement keys, actions). - **mouseDeltaX** (integer) - Required - Change in mouse X position. - **mouseDeltaY** (integer) - Required - Change in mouse Y position. ### Request Example ```json { "buttons": 1, "mouseDeltaX": 10, "mouseDeltaY": -5 } ``` ### Response #### Success Response (200) - **Response** - Indicates the input was processed. ### Response Example ```json { "status": "success" } ``` ## UnsubscribeFromCameraAsync ### Description Stops the camera streaming. ### Method POST ### Endpoint /camera/unsubscribe ### Response #### Success Response (200) - **Response** - Indicates the camera stream has been stopped. ### Response Example ```json { "status": "success" } ``` ```