Beispiel #1
0
        public List <Flow> GetFlows()
        {
            var url = $"{Constants.ApiUrl}{"flows"}";

            var responseText = Internet.Get(url, _apiKey);

            return(JsonConvert.DeserializeObject <List <Flow> >(responseText));
        }
Beispiel #2
0
        public List <MessageSearchResult> Search(string searchtext)
        {
            var result = new List <MessageSearchResult>();

            foreach (var flow in Flows)
            {
                var url = $"{Constants.ApiUrl}{"flows/"}{Constants.CompanyName}{"/"}{flow.ParameterizedName}{"/messages/?event=message&search="}{searchtext}";

                var responseText = Internet.Get(url, _apiKey);

                var searchResults = JsonConvert.DeserializeObject <List <MessageSearchResult> >(responseText)
                                    .Select(r => {
                    r.OriginalFlowName = flow.ParameterizedName;
                    r.FlowName         = flow.Name;
                    r.UserName         = Users.FirstOrDefault(u => u.Id == r.UserId)?.Name;
                    return(r);
                });

                result.AddRange(searchResults);
            }

            return(result);
        }