public SnowUser findUser(string userName) { if (userName == null) { throw new MissingFieldException("must provide user name"); } SnowClient client = new SnowClient("sys_user"); client.Query = "user_name=" + userName; client.ReturnFieldList = "sys_id,user_name,email,name"; Task <string> result = client.RunQuery(); string json = extractJson(result); return(JsonConvert.DeserializeObject <SnowUser>(json)); }
public List <SnowIncident> findAssignedIncidents(string user_sysid) { if (user_sysid == null) { throw new MissingFieldException("Must provide system user id"); } SnowClient client = new SnowClient("incident"); client.Query = "assigned_to=" + user_sysid; client.ReturnFieldList = "number,sys_id,description,short_description,state,severity," + "close_code,sys_created_on,opened_at,closed_at,closed_by," + "assigned_to,caller,resolved_by,closed"; Task <string> result = client.RunQuery(); string json = extractJson(result); List <SnowIncident> incidents = JsonConvert.DeserializeObject <List <SnowIncident> >(json); return(incidents); }