/// <summary> /// Activate the given user with the activation code /// /// Send GET request to APIROOT/users/activate/{userId}/{activationCode} /// </summary> /// <param name="activate">Identifier of the user secured by the activation code to activate</param> public void Activate(Activate activate) { RestConnection.Get(string.Format("users/activate/{0}/{1}", activate.UserId, activate.ActivationCode)); }
/// <summary> /// Query the currently logged in user /// /// Send GET request to APIROOT/users/me /// </summary> /// <returns>Current user properties like full name and email address</returns> /// <exception cref="WebException">In case of any service side error an exception will be thrown. Please refer to the HTTP error code for more information</exception> public User Get() { var userStr = RestConnection.Get("users/me"); return(JsonSerializer.Deserialize <User>(userStr)); }
/// <summary> /// Find an user by email address. Only exact matches will work while the comparison is implemented case insensitively on the service side. /// /// Send GET request to APIROOT/users/byemail/UrlEncode(email)/ /// </summary> /// <param name="email">Email address to look for</param> /// <returns>User entity if the email address matches otherwise a null will be returned.</returns> /// <exception cref="WebException">In case of any service side error an exception will be thrown. Please refer to the HTTP error code for more information</exception> public User FindUser(string email) { var userStr = RestConnection.Get("users/byemail/" + email + "/"); return(JsonSerializer.Deserialize <User>(userStr)); }
/// <summary> /// List devices that are under this network /// /// Send GET request to the APIROOT/networks/id/devices Url /// </summary> /// <param name="id">Unique identifier of the network</param> /// <returns>List of devices</returns> /// <exception cref="WebException">This exception indicates some service level error. Please refer to the HTTP error code for more information</exception> public IEnumerable <Small> ListDevices(string id) { var items = RestConnection.Get("networks/" + id + "/devices"); return(JsonSerializer.Deserialize <List <Small> >(items)); }
/// <summary> /// Get the full detail of a device /// /// Send GET request to the APIROOT/devices/id Url /// </summary> /// <param name="id">Unique identifier of a device</param> /// <returns>Device details</returns> /// <exception cref="WebException">This exception indicates some service level error. Please refer to the HTTP error code for more information</exception> public Device Get(string id) { var response = RestConnection.Get("devices/" + id); return(JsonSerializer.Deserialize <Device>(response)); }
/// <summary> /// Get the full detail of a network /// /// Send GET request to the APIROOT/networks/id Url /// </summary> /// <param name="id">Unique identifier of a network</param> /// <returns>Network details</returns> /// <exception cref="WebException">This exception indicates some service level error. Please refer to the HTTP error code for more information</exception> public Network Get(string id) { var response = RestConnection.Get("networks/" + id); return(JsonSerializer.Deserialize <Network>(response)); }
/// <summary> /// Query the telemetry data sinks list with all required metadata /// /// Send GET request to the APIROOT/telemetryMetadata Url /// </summary> /// <returns>List of applicable telemetry data sinks with metadata</returns> public TelemetryDataSinksMetadata Get() { var response = RestConnection.Get("telemetryMetadata"); return(JsonSerializer.Deserialize <TelemetryDataSinksMetadata>(response)); }
/// <summary> /// List services that are run by the company /// /// Send GET request to the APIROOT/companies/id/services Url /// </summary> /// <param name="id">Unique identifier of the company</param> /// <returns>List of services</returns> /// <exception cref="WebException">This exception indicates some service level error. Please refer to the HTTP error code for more information</exception> public IEnumerable <Small> ListServices(string id) { var items = RestConnection.Get("companies/" + id + "/services"); return(JsonSerializer.Deserialize <List <Small> >(items)); }
/// <summary> /// Get the full detail of a company /// /// Send GET request to the APIROOT/companies/id Url /// </summary> /// <param name="id">Unique identifier of a company</param> /// <returns>Company details</returns> /// <exception cref="WebException">This exception indicates some service level error. Please refer to the HTTP error code for more information</exception> public Company Get(string id) { var response = RestConnection.Get("companies/" + id); return(JsonSerializer.Deserialize <Company>(response)); }
/// <summary> /// List all companies that the currently logged in user can see and access /// /// Send GET request to the APIROOT/companies Url /// </summary> /// <returns>List of the companies with the most important properties (id, name)</returns> /// <exception cref="WebException">This exception indicates some service level error. Please refer to the HTTP error code for more information</exception> public IEnumerable <Small> List() { var items = RestConnection.Get("companies"); return(JsonSerializer.Deserialize <List <Small> >(items)); }