Update to handle the new RouterOS v7.18 api syntax with empty responses#105
Conversation
- Added handling for `ApiEmptySentence` in `ApiCommand.cs` to return an empty list when the first response is empty. - Introduced `!empty` case in `ApiConnection.cs` to process empty responses. - Created `ApiEmptySentence` class to manage empty response types, enhancing API functionality.
Deantwo
left a comment
There was a problem hiding this comment.
Change looks elegant and follows the same conventions as already used in the project.
|
Hi, |
The original maintainer of this project has been MIA for a few years now. So there likely won't be any updates to the original NuGet package, unless he suddenly returns. But you can download the master from https://github.com/Deantwo/tik4net or https://github.com/xPucTu4/tik4net and compile it yourself instead, since they both have this and my other changes already. |
|
Thanks for the quick and precise answer, I was not aware of this fact, I would have waited months before realizing it. |
|
I actually published it a while ago: It's not showing up in searches because I haven’t had time to set up a public GitHub repo and a proper build/publish pipeline yet. If anyone is willing to help with this, it would be greatly appreciated! |
|
|
||
| namespace tik4net.Api | ||
| { | ||
| internal class ApiEmptySentence : ApiReSentence, ITikDoneSentence |
There was a problem hiding this comment.
I just realized that you are using ApiReSentence and ITikDoneSentence here. You should probably have made a ITikEmptySentence class.
I guess this does make it more hacky than I originally thought now that I work more with it.
I assume it breaks the ExecuteSingleRow and ExecuteSingleRowOrDefault methods, since it will look like a ApiReSentence is returned, but it is empty.
ApiConnection already skips !empty by recursing (case "!empty": return ReadSentence()). The ApiEmptySentence class introduced by PR #105 is never instantiated, so remove it and the dead check in ApiCommand to keep the codebase clean. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ApiEmptySentenceinApiCommand.csto return an empty list when the first response is empty.!emptycase inApiConnection.csto process empty responses.ApiEmptySentenceclass to manage empty response types, enhancing API functionality.Closes #103
This is a duplicate of PR #104 , recreated due to unintended additional changes in the original PR.