Beispiel #1
0
        static void Main(string[] args)
        {
            // set our default folder and query names
            string folderName   = null;
            string queryName    = null;
            string exportFormat = null;

            // use the arguments from the command line if we got any
            if (args.Length == 3)
            {
                folderName   = args[0];
                queryName    = args[1];
                exportFormat = args[2];
            }
            else
            {
                throw new ArgumentException("Command line arguments not provided");
            }

            // give our bitly client our access token if there is one (not required)
            BitlyClient.AccessToken = ConfigurationManager.AppSettings["BitlyAccessToken"];

            // grab our team services info
            var token   = ConfigurationManager.AppSettings["TeamServicesPersonalAccessToken"];
            var url     = ConfigurationManager.AppSettings["TeamServicesCollectionUrl"];
            var project = ConfigurationManager.AppSettings["TeamServicesProjectName"];

            // make sure we have the necessary info
            if (string.IsNullOrEmpty(token) == true ||
                string.IsNullOrEmpty(url) == true ||
                string.IsNullOrEmpty(project) == true)
            {
                Console.WriteLine("You must set the Team Services Personal Access Token, Colection URL, and project name in the App.config");
                return;
            }

            // create our team services client
            var client = new TeamServicesClient(url, token, project);

            // retrieve the result set for the given query
            var result = client.RunQuery(folderName, queryName);

            // shorten the urls in the items
            BitlyClient.ShortenUrls(result.Items);

            // export the query results
            switch (exportFormat)
            {
            case "csv":
                CsvExporter.ExportItems(queryName, result);
                break;

            case "html":
                HtmlExporter.ExportItems(queryName, result);
                break;
            }
        }
Beispiel #2
0
 static void Main(string[] args)
 {
     using (var client = new BitlyClient(@"ioleksiy", @"R_e354e81a3f95be42d77405d3599a45d2"))
     {
         var shorten = client.Shorten("http://google.com.ua/");
         var expanded1 = client.Expand(shorten.Data.Url);
         var expanded2 = client.ExpandWithHashes(shorten.Data.Hash);
         var validate = client.Validate("ioleksiy", "R_e354e81a3f95be42d77405d3599a45d2");
         var validDomain = client.IsBitlyProDomain("nyti.ms");
         var lookup = client.Lookup("http://betaworks.com/");
         var auth = client.Authenticate("ioleksiy", "not_my_password :)))");
         var info = client.Info("http://google.com.ua/");
     }
 }
Beispiel #3
0
 public SlackRequestProcessor()
 {
     _triggerWordMap = new Dictionary <CommandType, Func <SlackResponse> >
     {
         { CommandType.Help, Help },
         { CommandType.Info, Info },
         { CommandType.SetProjectId, SetProjectId },
         { CommandType.AddTasks, AddTasks },
         { CommandType.AddStory, AddStory },
         { CommandType.AddDefaultTask, AddDefaultTask },
         { CommandType.ClearDefaultTasks, ClearDefaultTasks },
         { CommandType.SetDefaultTasksFromJson, SetDefaultTasksFromJson },
         { CommandType.RandomFractal, RandomFractal },
         { CommandType.AddCats, AddCats },
         { CommandType.YouTube, YouTube },
         { CommandType.Imgur, Imgur },
         { CommandType.GoogleBooks, GoogleBooks },
         { CommandType.GoogleVision, GoogleVision },
         { CommandType.SendText, SendText },
         { CommandType.SearchRepos, SearchRepos }
     };
     _databaseClient = !string.IsNullOrEmpty(ConfigurationManager.AppSettings["SqlConnectionString"])
         ? (IDatabaseClient) new SqlDatabaseClient()
         : new RavenDatabaseClient();
     _pivotalClient      = new PivotalClient();
     _fractalClient      = new FractalClient();
     _bitlyClient        = new BitlyClient();
     _catApiClient       = new CatApiClient();
     _imgurClient        = new ImgurClient();
     _youTubeClient      = new YouTubeClient();
     _googleVisionClient = new GoogleVisionClient();
     _googleBooksClient  = new GoogleBooksClient();
     _textBeltClient     = new TextBeltClient();
     _gitHubClient       = new GitHubClient();
     _validator          = new RequestValidator();
 }