A .net wrapper for the IceWarp API
IceWarp.Net fully implements the IceWarp API RPC calls.
PM> Install-Package IceWarp.Netstring apiUrl = "http://localhost/icewarpapi/";
var api = new IceWarpRpcApi();
Authenticate authenticate = new Authenticate
{
AuthType = TAuthType.Plain,
Digest = "",
Email = "[email protected]",
Password = "password",
PersistentLogin = false
};
SuccessResponse authResult = api.Execute(apiUrl, authenticate);
GetSessionInfo sessionInfo = new GetSessionInfo
{
SessionId = authResult.SessionId
};
TAPISessionInfoResponse sessionInfoResult = api.Execute(apiUrl, sessionInfo);
Logout logout = new Logout
{
SessionId = authResult.SessionId
};
SuccessResponse logoutResult = api.Execute(apiUrl, logout);
Get Properties requests can be converted into objects similar to the Com Objects installed on the server.
Create a Domain object from a GetDomainProperties request.
GetDomainProperties getPropertiesRequest = new GetDomainProperties
{
SessionId = "session id",
DomainStr = "testing.co.uk",
DomainPropertyList = new TDomainPropertyList
{
Items = ClassHelper.PublicProperites(typeof(Domain)).Select(x => x.Name).ToList()
}
};
TPropertyValueListResponse getPropertiesResult = api.Execute(apiUrl, getPropertiesRequest);
Domain domain = new Domain(getPropertiesResult.Items);
Create a SetDomainProperties request from a Domain object.
Domain domain = new Domain
{
D_Description = "description",
D_AdminEmail = "[email protected]
};
List<TPropertyValue> propertyValues = domain.BuildTPropertyValues();
SetDomainProperties setPropertiesRequest = new SetDomainProperties
{
SessionId = "session id",
DomainStr = "testing.co.uk",
PropertyValueList = new TPropertyValueList
{
Items = propertyValues
}
};
Create a SetDomainProperties request from specific properties of a Domain object.
Domain domain = new Domain
{
D_Description = "description",
D_AdminEmail = "[email protected]
};
List<TPropertyValue> propertyValues = domain.BuildTPropertyValues(new List<string> { "D_Description" });
SetDomainProperties setPropertiesRequest = new SetDomainProperties
{
SessionId = "session id",
DomainStr = "testing.co.uk",
PropertyValueList = new TPropertyValueList
{
Items = propertyValues
}
};