static IFigmaDocumentContainer GetFigmaDialogFromResponse(FigmaResponse figmaResponse, string viewName = null, string nodeName = null) { var resultNodes = new List <FigmaNode> (); FigmaNode[] figmaNodes = figmaResponse.document.children; if (!string.IsNullOrEmpty(nodeName)) { figmaNodes.Recursively(nodeName, resultNodes); var figmaFrame = (FigmaFrameEntity)resultNodes.FirstOrDefault(); if (figmaFrame == null) { return(null); } figmaNodes = figmaFrame.children; resultNodes.Clear(); } if (string.IsNullOrEmpty(viewName)) { return(figmaNodes.FirstOrDefault() as IFigmaDocumentContainer); } figmaNodes.Recursively(viewName, resultNodes); if (resultNodes.Count == 0) { return(null); } return(resultNodes.FirstOrDefault() as IFigmaDocumentContainer); }
public static void SetFigmaResponseFromContent(FigmaResponse figmaResponse, string filePath) { var data = JsonConvert.SerializeObject(figmaResponse); if (File.Exists(filePath)) { File.Delete(filePath); } File.WriteAllText(filePath, data); }
public void SetFigmaResponseFromContent(FigmaResponse figmaResponse, string filePath) => FigmaApiHelper.SetFigmaResponseFromContent(figmaResponse, filePath);
public FigmaFrameEntityResponse(FigmaResponse figmaResponse, int page) { Page = page; FigmaResponse = figmaResponse; }