c# version of API wrapper