Exemplo n.º 1
0
        public Projects TryGetProjects(string siteId, string authToken)
        {
            var handler = new ProjectsHandler {
                ServerAddress = ServerUrl, ApiVersion = ApiVersion, SiteId = siteId
            };

            handler.LogEventHandler += RedirectLogFromRequestHandlers;

            return(handler.GetResponse(authToken));
        }
Exemplo n.º 2
0
        private static IHandlerMapper InitApi(ConfigurationProviderBase prov)
        {
            string root = "api/";
            VerbRestrictingMatchRule verbs = new VerbRestrictingMatchRule(HttpVerbs.GET.ToString(), HttpVerbs.POST.ToString());
            UrlBaseMatchRule         url   = new UrlBaseMatchRule(new string[] { root });

            verbs.NextMatcher = url;

            ServerRouting   router = new ServerRouting();
            SessionIdHeader head   = new SessionIdHeader();

            head.Next = router;
            MatchRuleMapHandler mapper = new MatchRuleMapHandler(head, verbs);

            //add all other handlers
            Session s = new Session();

            router.Map.Add(new UrlBaseMapHandler(s, root + s.BaseUrl));

            Login l = new Login();

            router.Map.Add(new UrlBaseMapHandler(l, root + l.BaseUrl));

            UserAuthorizations au = new UserAuthorizations();

            router.Map.Add(new UrlBaseMapHandler(au, root + au.BaseUrl));

            UserAffiliationHandler uah = new UserAffiliationHandler();

            router.Map.Add(new UrlBaseMapHandler(uah, root + uah.BaseUrl));

            Request req = new Request();

            router.Map.Add(new UrlBaseMapHandler(req, root + req.BaseUrl));

            OrganizationHandler orgs = new OrganizationHandler();

            router.Map.Add(new UrlBaseMapHandler(orgs, root + orgs.BaseUrl));

            SitesHandler sites = new SitesHandler();

            router.Map.Add(new UrlBaseMapHandler(sites, root + sites.BaseUrl));

            ProjectsHandler projs = new ProjectsHandler();

            router.Map.Add(new UrlBaseMapHandler(projs, root + projs.BaseUrl));

            FieldActivitiesHandler fas = new FieldActivitiesHandler();

            router.Map.Add(new UrlBaseMapHandler(fas, root + fas.BaseUrl));

            FileTransferHandler fts = new FileTransferHandler();

            router.Map.Add(new UrlBaseMapHandler(fts, root + fts.BaseUrl));

            InstrumentsHandler inst = new InstrumentsHandler();

            router.Map.Add(new UrlBaseMapHandler(inst, root + inst.BaseUrl));

            PersonsHandler per = new PersonsHandler();

            router.Map.Add(new UrlBaseMapHandler(per, root + per.BaseUrl));

            TaxaHandler tax = new TaxaHandler();

            router.Map.Add(new UrlBaseMapHandler(tax, root + tax.BaseUrl));

            WQHandler wq = new WQHandler();

            router.Map.Add(new UrlBaseMapHandler(wq, root + wq.BaseUrl));

            FishHandler fish = new FishHandler();

            router.Map.Add(new UrlBaseMapHandler(fish, root + fish.BaseUrl));

            VegetationHandler veg = new VegetationHandler();

            router.Map.Add(new UrlBaseMapHandler(veg, root + veg.BaseUrl));

            EntityBundlesHandler ebh = new EntityBundlesHandler();

            router.Map.Add(new UrlBaseMapHandler(ebh, root + ebh.BaseUrl));

            DetsHandler det = new DetsHandler();

            router.Map.Add(new UrlBaseMapHandler(det, root + det.BaseUrl));

            return(mapper);
        }