public static ResponseModels.AFEventFrame Convert(LazyObjects.AFEventFrame frame) { ResponseModels.AFEventFrame result = new ResponseModels.AFEventFrame(frame.ID, frame.WebID, frame.Name, frame.Description, frame.Path); //TODO: Need to add support for categories //result.CategoryNames = frame.CategoryNames.ToList(); result.StartTime = frame.StartTime; result.EndTime = frame.EndTime; result.TemplateName = frame.Template.Name; return(result); }
public bool CreateEventFrame(LazyPI.Common.Connection Connection, string DatabaseID, LazyPI.LazyObjects.AFEventFrame EventFrame) { WebAPIConnection webConnection = (WebAPIConnection)Connection; var request = new RestRequest("/assetdatabases/{webId}/eventframes", Method.POST); request.AddUrlSegment("webId", DatabaseID); ResponseModels.AFEventFrame body = DataConversions.Convert(EventFrame); request.AddParameter("application/json; charset=utf-8", Newtonsoft.Json.JsonConvert.SerializeObject(body), ParameterType.RequestBody); var statusCode = webConnection.Client.Execute(request).StatusCode; return((int)statusCode == 204); }
public string GetEventFrameTemplate(LazyPI.Common.Connection Connection, string FrameID) { WebAPIConnection webConnection = (WebAPIConnection)Connection; var request = new RestRequest("/eventframes/{webId}"); request.AddUrlSegment("webId", FrameID); var response = webConnection.Client.Execute <ResponseModels.AFEventFrame>(request); if (response.ErrorException != null) { throw new ApplicationException("Error finding event frame by ID. (See Inner Details)", response.ErrorException); } ResponseModels.AFEventFrame data = response.Data; return(data.TemplateName); }