Skip to content

Commit

Permalink
Merge pull request #139 from AndreasReitberger/138-find-and-fix-wrong…
Browse files Browse the repository at this point in the history
…-httpmethod

Fixed wrong `Http.Methods`
  • Loading branch information
AndreasReitberger authored Nov 9, 2024
2 parents 3dd203d + 59f3fad commit 35fdea7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 22 deletions.
2 changes: 0 additions & 2 deletions src/MoonrakerSharpWebApi/MoonrakerClient.Database.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public async Task<List<string>> ListDatabaseNamespacesAsync()
command: "database/list",
jsonObject: null,
authHeaders: AuthHeaders,
//urlSegments: urlSegments,
cts: default
)
.ConfigureAwait(false);
Expand Down Expand Up @@ -105,7 +104,6 @@ public async Task<Dictionary<string, object>> GetDatabaseItemAsync(string namesp
// If namespace is missing, just return an empty resultObject now
else return resultObject;
}

Dictionary<string, string> urlSegments = new()
{
{ "namespace", namespaceName }
Expand Down
13 changes: 0 additions & 13 deletions src/MoonrakerSharpWebApi/MoonrakerClient.Printers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,13 @@ public async Task RefreshPrinterInfoAsync()
KlipperPrinterStateMessageResult? resultObject = null;
try
{
//object cmd = new { name = ScriptName };

string targetUri = $"{MoonrakerCommands.Printer}";
result = await SendRestApiRequestAsync(
requestTargetUri: targetUri,
method: Method.Get,
command: "info",
jsonObject: null,
authHeaders: AuthHeaders,
//urlSegments: urlSegements,
cts: default
)
.ConfigureAwait(false);
Expand Down Expand Up @@ -128,16 +125,13 @@ public async Task<bool> EmergencyStopPrinterAsync()
{
try
{
//object cmd = new { name = ScriptName };

string targetUri = $"{MoonrakerCommands.Printer}";
IRestApiRequestRespone? result = await SendRestApiRequestAsync(
requestTargetUri: targetUri,
method: Method.Post,
command: "emergency_stop",
jsonObject: null,
authHeaders: AuthHeaders,
//urlSegments: urlSegements,
cts: default
)
.ConfigureAwait(false);
Expand All @@ -159,15 +153,13 @@ public async Task<bool> RestartPrinterAsync()
{
try
{
//object cmd = new { name = ScriptName };
string targetUri = $"{MoonrakerCommands.Printer}";
IRestApiRequestRespone? result = await SendRestApiRequestAsync(
requestTargetUri: targetUri,
method: Method.Post,
command: "restart",
jsonObject: null,
authHeaders: AuthHeaders,
//urlSegments: urlSegements,
cts: default
)
.ConfigureAwait(false);
Expand All @@ -189,15 +181,13 @@ public async Task<bool> RestartFirmwareAsync()
{
try
{
//object cmd = new { name = ScriptName };
string targetUri = $"{MoonrakerCommands.Printer}";
IRestApiRequestRespone? result = await SendRestApiRequestAsync(
requestTargetUri: targetUri,
method: Method.Post,
command: "firmware_restart",
jsonObject: null,
authHeaders: AuthHeaders,
//urlSegments: urlSegements,
cts: default
)
.ConfigureAwait(false);
Expand Down Expand Up @@ -319,15 +309,13 @@ public async Task<List<string>> GetPrinterObjectListAsync(string startsWith = ""
List<string> resultObject = [];
try
{
//object cmd = new { name = ScriptName };
string targetUri = $"{MoonrakerCommands.Printer}";
result = await SendRestApiRequestAsync(
requestTargetUri: targetUri,
method: Method.Get,
command: "objects/list",
jsonObject: null,
authHeaders: AuthHeaders,
//urlSegments: urlSegements,
cts: default
)
.ConfigureAwait(false);
Expand Down Expand Up @@ -1268,7 +1256,6 @@ public async Task<string> SubscribeAllPrinterObjectStatusAsync(long? connectionI
command: "query_endstops/status",
jsonObject: null,
authHeaders: AuthHeaders,
//urlSegments: urlSegements,
cts: default
)
.ConfigureAwait(false);
Expand Down
1 change: 0 additions & 1 deletion src/MoonrakerSharpWebApi/MoonrakerClient.WebCam.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public partial class MoonrakerClient
command: "webcams/list",
jsonObject: null,
authHeaders: AuthHeaders,
//urlSegments: urlSegments,
cts: default
)
.ConfigureAwait(false);
Expand Down
11 changes: 5 additions & 6 deletions src/MoonrakerSharpWebApi/MoonrakerClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1345,7 +1345,7 @@ public async Task<Dictionary<string, string>> GetGcodeHelpAsync()
string targetUri = $"{MoonrakerCommands.Printer}";
result = await SendRestApiRequestAsync(
requestTargetUri: targetUri,
method: Method.Post,
method: Method.Get,
command: "gcode/help",
jsonObject: null,
authHeaders: AuthHeaders,
Expand Down Expand Up @@ -1563,7 +1563,7 @@ public async Task<bool> MoveAxesAsync(
string targetUri = $"{MoonrakerCommands.Machine}";
result = await SendRestApiRequestAsync(
requestTargetUri: targetUri,
method: Method.Post,
method: Method.Get,
command: "system_info",
jsonObject: null,
authHeaders: AuthHeaders,
Expand Down Expand Up @@ -2867,7 +2867,7 @@ await SendRestApiRequestAsync(MoonrakerCommandBase.machine, Method.Get, $"device
public async Task<Dictionary<string, string>> SetDeviceStateAsync(string device, KlipperDeviceActions action)
{
IRestApiRequestRespone? result = null;
Dictionary<string, string> resultObject = new();
Dictionary<string, string> resultObject = [];
try
{
Dictionary<string, string> urlSegments = new()
Expand Down Expand Up @@ -2969,7 +2969,7 @@ await SendRestApiRequestAsync(MoonrakerCommandBase.machine, Method.Get, $"device
public async Task<Dictionary<string, string>> SetBatchDeviceOnAsync(string[] devices)
{
IRestApiRequestRespone? result = null;
Dictionary<string, string> resultObject = new();
Dictionary<string, string> resultObject = [];
try
{
StringBuilder deviceList = new();
Expand Down Expand Up @@ -3361,7 +3361,7 @@ await SendRestApiRequestAsync(MoonrakerCommandBase.api, Method.Post, "printer/co
}
}
public Task<bool> SendOctoPrintApiGcodeCommandAsync(string command) => SendOctoPrintApiGcodeCommandAsync(new string[] { command });
public Task<bool> SendOctoPrintApiGcodeCommandAsync(string command) => SendOctoPrintApiGcodeCommandAsync([command]);
public async Task<Dictionary<string, OctoprintApiPrinter>> GetOctoPrintApiPrinterProfilesAsync()
{
Expand Down Expand Up @@ -3486,7 +3486,6 @@ await SendRestApiRequestAsync(MoonrakerCommandBase.server, Method.Get, $"history
command: $"history/totals",
jsonObject: null,
authHeaders: AuthHeaders,
//urlSegments: urlSegments,
cts: default
)
.ConfigureAwait(false);
Expand Down

0 comments on commit 35fdea7

Please sign in to comment.