OctoPrintSharpApi 1.1.7

There is a newer version of this package available.
See the version list below for details.
dotnet add package OctoPrintSharpApi --version 1.1.7                
NuGet\Install-Package OctoPrintSharpApi -Version 1.1.7                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="OctoPrintSharpApi" Version="1.1.7" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add OctoPrintSharpApi --version 1.1.7                
#r "nuget: OctoPrintSharpApi, 1.1.7"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install OctoPrintSharpApi as a Cake Addin
#addin nuget:?package=OctoPrintSharpApi&version=1.1.7

// Install OctoPrintSharpApi as a Cake Tool
#tool nuget:?package=OctoPrintSharpApi&version=1.1.7                

OctoPrintRestApiSharp

A simple C# library to communicate with an OctoPrint server via REST-API.

Nuget

Get the latest version from nuget.org<br> NuGet NuGet

Usage

You can find some usage examples in the TestProject of the source code.

Init a new server

Just create a new OctoPrintServer object by passing the host, api, port and ssl connection type.

OctoPrintServer _server = new OctoPrintServer(_host, _api, _port, _ssl);
await _server.CheckOnlineAsync();
if (_server.IsOnline)
{
    // Sets the first printer active
    if (_server.ActivePrinter == null)
        await _server.SetPrinterActiveAsync(0, true);

    await _server.RefreshAllAsync();
    Assert.IsTrue(_server.InitialDataFetched);
}

Since then, you can access all functions from the OctoPrintServer object.

Instance

If you want to use the OctoPrintServer from different places, use the Instance.

OctoPrintServer.Instance = new OctoPrintServer(_host, _api, _port, _ssl);
await OctoPrintServer.Instance.CheckOnlineAsync();

Aferwards you can use the OctoPrintServer.Instance property to access all functions through your project.

var files = await OctoPrintServer.Instance.GetAllFilesAsync("local");

Available methods

Please find the some usage examples for the methods below.

// Load all files from the Server
var files = await OctoPrintServer.Instance.GetAllFilesAsync("local");

// Get all printer profiles
var printers = await OctoPrintServer.Instance.GetAllPrinterProfilesAsync();

// Update heated bed temperature & read back the state
bool result = await OctoPrintServer.Instance.SetBedTemperatureAsync(25);
var state = await OctoPrintServer.Instance.GetCurrentBedStateAsync(true);

// Update extruder (tool0 or / and tool1) & read back the state
bool result = await _OctoPrintServer.Instance.SetToolTemperatureAsync(30);
var state = await OctoPrintServer.Instance.GetCurrentToolStateAsync(true);

var jobinfo = await OctoPrintServer.Instance.GetJobInfoAsync();

Dependencies

RCoreSharp: https://github.com/AndreasReitberger/CoreSharp

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on OctoPrintSharpApi:

Package Downloads
GcodeParserSharp

A simple C# Gcode parser to read gcodes and get out the filament volume and estimated print time.

GcodeParserSharp.Maui

A simple C# Gcode parser to read gcodes and get out the filament volume and estimated print time.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.3-preview 175 4/22/2024
1.2.2 740 6/16/2023
1.2.1 453 2/19/2023
1.2.0 327 12/11/2022
1.1.7 766 4/5/2022
1.1.5 448 2/12/2022
1.1.3 444 12/19/2021
1.1.2 855 12/1/2021