Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Zabbix.API.Core/Models/Request.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,13 @@ public Request(string jsonrpc, string method, int id, string auth, dynamic @para
this.auth = auth;
this.@params = @params;
}

public Request(string jsonrpc, string method, int id, dynamic @params)
{
this.jsonrpc = jsonrpc;
this.method = method;
this.id = id;
this.@params = @params;
}
}
}
18 changes: 18 additions & 0 deletions Zabbix.API.Core/Zabbix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ public async Task<string> GetResponseJsonAsync(string method, object parameters)
return jsonResponse;
}

public async Task<string> GetResponseJsonAsyncNoAuth(string method, object parameters)
{
Request request = new Request("2.0", method, 1, parameters);

string jsonParams = JsonConvert.SerializeObject(request);
string jsonResponse = await SendRequestAsync(jsonParams);

return jsonResponse;
}

public async Task<string> GetDeleteResponseJSonAsync(string method, List<int> parameters)
{
DeleteRequest request = new DeleteRequest("2.0", method, 1, auth, parameters);
Expand All @@ -74,6 +84,14 @@ public async Task<Response> GetResponseObjectAsync(string method, object paramet
return objectResponse;
}

public async Task<Response> GetResponseObjectAsyncNoAuth(string method, object parameters)
{
string jsonResponse = await GetResponseJsonAsyncNoAuth(method, parameters);
var objectResponse = ConvertJsonToResponse(jsonResponse);

return objectResponse;
}

private Response ConvertJsonToResponse(string json)
{
Response response = JsonConvert.DeserializeObject<Response>(json);
Expand Down