Пример #1
0
        public async Task <bool> Login(WorkfrontConfiguration config)
        {
            this.config = config;
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(config.VersionedUrl);
                var resultResponse = await GetApiKey(client);

                if (resultResponse == null || !resultResponse.IsValid)
                {
                    resultResponse = await GenerateApiKey(client);
                }
                if (resultResponse.IsValid)
                {
                    config.Token = resultResponse.Result;

                    var sessionResult = await GetSessionID(client);

                    if (sessionResult != null)
                    {
                        config.SessionID = sessionResult.SessionID;
                        return(true);
                    }
                }
                return(false);
            }
        }
Пример #2
0
        public static async Task <WorkfrontService> Connect(WorkfrontConfiguration config)
        {
            var login = new WorkfrontLogin();
            await login.Login(config);


            return(new WorkfrontService(config));
        }
Пример #3
0
 WorkfrontService(WorkfrontConfiguration config)
 {
     this.config = config;
     uriBuilder  = new WorkfrontUriBuilder(config);
 }
Пример #4
0
 public DocumentDownloader(WorkfrontConfiguration config)
 {
     this.rootUrl   = config.UrlPrefix;
     this.sessionID = config.SessionID;
 }