Example #1
0
        /// <summary>
        /// Start the export on the given url
        /// </summary>
        /// <param name="url">The Url to the API, something like: https://app.totango.com/api/v1/accounts/active_list/10010/current.json</param>
        /// <param name="outname">The name of the output file</param>
        /// <param name="confUrl">Optional confirmation base url</param>
        public string Start(string url, string outname, string confUrl = "")
        {
            string        id    = this._sqlLog.addCall();
            List <string> lines = new List <string>();

            lines.Add(this._aliasHead);
            if (this._headers.Length > 0)
            {
                using (ToTangoReader tangoReader = new ToTangoReader(this._token, url))
                {
                    dynamic account = null;
                    do
                    {
                        account = tangoReader.ReadAccount();
                        if (account != null)
                        {
                            lines.Add(concatAttribs(id, account));
                            if (!String.IsNullOrEmpty(confUrl))
                            {
                                sendConfirmation(account, confUrl);
                            }
                        }
                    }while (account != null);
                }
            }
            outname = newName(outname);
            File.WriteAllLines(outname, lines);
            return(outname);
        }
Example #2
0
 /// <summary>
 /// Start the export on the given url
 /// </summary>
 /// <param name="url">The Url to the API, something like: https://app.totango.com/api/v1/accounts/active_list/10010/current.json</param> 
 /// <param name="outname">The name of the output file</param>
 /// <param name="confUrl">Optional confirmation base url</param>
 public string Start(string url, string outname, string confUrl = "")
 {
     string id = this._sqlLog.addCall();
     List<string> lines = new List<string>();
     lines.Add(this._aliasHead);
     if (this._headers.Length > 0)
     {
         using (ToTangoReader tangoReader = new ToTangoReader(this._token, url))
         {
             dynamic account = null;
             do
             {
                 account = tangoReader.ReadAccount();
                 if (account != null)
                 {
                     lines.Add(concatAttribs(id, account));
                     if (!String.IsNullOrEmpty(confUrl))
                         sendConfirmation(account, confUrl);
                 }
             }
             while (account != null);
         }
     }
     outname = newName(outname);
     File.WriteAllLines(outname, lines);
     return outname;
 }
Example #3
0
 /// <summary>
 /// Start the export on the given url
 /// </summary>
 /// <param name="url">The Url to the API, something like: https://app.totango.com/api/v1/accounts/active_list/10010/current.json</param> 
 /// <param name="outDirectory">The directory for output file</param>
 /// <param name="outName">The name of the output file</param>        
 /// <param name="confUrl">Optional confirmation base url</param>
 public string Start(string url, string outDirectory, string outName, string confUrl = "")
 {
     string name = "";
     List<string> lines = new List<string>();
     lines.Add(this._aliasHead);
     if (this._headers.Length > 0)
     {
         using (ToTangoReader tangoReader = new ToTangoReader(this._token, url))
         {
             name = tangoReader.ReadName();
             string id = this._sqlLog.AddCall(name, url);
             dynamic account = null;
             do
             {
                 account = tangoReader.ReadAccount();
                 if (account != null)
                 {
                     lines.Add(concatAttribs(id, account));
                     if (!String.IsNullOrEmpty(confUrl))
                         sendConfirmation(account, confUrl);
                 }
             }
             while (account != null);
         }
     }
     string ext = Path.GetExtension(outName);
     if (name != "") outName = cleanName(name) + ext;
     outName = newName(outDirectory + "\\" + outName, ext);
     File.WriteAllLines(outName, lines);
     return outName;
 }
Example #4
0
 static void TestReader(string token)
 {
     dynamic account = null;
     string url = "https://app.totango.com/api/v1/accounts/active_list/1/current.json?return=stats";
     using (ToTangoReader tangoReader = new ToTangoReader(token, url))
     {
         do
         {
             account = tangoReader.ReadAccount();
             if (account != null)
             {
                 Console.ForegroundColor = ConsoleColor.Green;
                 Console.Write(account.name + " ");
                 Console.ForegroundColor = ConsoleColor.Cyan;
                 Console.WriteLine(account.totango_id);
             }
             else if (tangoReader.Error)
             {
                 Console.WriteLine(tangoReader.ErrorMessage);
             }
         }
         while (account != null);
     }
 }
Example #5
0
        static void TestReader(string token)
        {
            dynamic account = null;
            string  url     = "https://app.totango.com/api/v1/accounts/active_list/1/current.json?return=stats";

            using (ToTangoReader tangoReader = new ToTangoReader(token, url))
            {
                do
                {
                    account = tangoReader.ReadAccount();
                    if (account != null)
                    {
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.Write(account.name + " ");
                        Console.ForegroundColor = ConsoleColor.Cyan;
                        Console.WriteLine(account.totango_id);
                    }
                    else if (tangoReader.Error)
                    {
                        Console.WriteLine(tangoReader.ErrorMessage);
                    }
                }while (account != null);
            }
        }