Ejemplo n.º 1
0
        private bool FolderIsValid()
        {
            bool result = false;

            try
            {
                string                   key         = GetSettingFromCosmos("Key");
                APISendingBlue           sendinBlue  = new APISendingBlue(key);
                Dictionary <string, int> foldersData = new Dictionary <string, int>();
                Dictionary <string, int> folderData  = new Dictionary <string, int>();
                foldersData.Add("page", 1);
                foldersData.Add("page_limit", 1);

                //Todo
                dynamic folders = sendinBlue.get_folders(foldersData);

                // get result
                if (folders.code == "success")
                {
                    result = true;
                }
            }
            catch (Exception e)
            {
                var messageException = telemetria.MakeMessageException(e, System.Reflection.MethodBase.GetCurrentMethod().Name);
                telemetria.Critical(messageException);
            }
            return(result);
        }
Ejemplo n.º 2
0
        public List <Folder> GetAllFolders()
        {
            List <Folder> folders = new List <Folder> {
            };

            try
            {
                if (ApiKey != string.Empty)
                {
                    APISendingBlue           sendinBlue = new APISendingBlue(ApiKey);
                    Dictionary <string, int> data       = new Dictionary <string, int>();
                    data.Add("page", 1);
                    data.Add("page_limit", 10);

                    dynamic foldersResponse = sendinBlue.get_folders(data);
                    if (foldersResponse.code == "success")
                    {
                        folders = foldersResponse.data.folders.ToObject <List <Folder> >();
                        for (var i = 0; i <= (folders.Count - 1); i++)
                        {
                            folders[i].Listas = folders[i].lists.ToObject <List <Lista> >();
                        }
                    }
                }
            }
            catch (Exception e)
            {
                string exceptionMessage = telemetria.MakeMessageException(e, System.Reflection.MethodBase.GetCurrentMethod().Name);
                telemetria.Critical(exceptionMessage);
            }
            return(folders.ToList());
        }