/// <summary>
        /// 取得InvocieApi代理
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="model"></param>
        /// <returns></returns>
        public static ApiBase <T> GetProxyInstace <T>(T model,
                                                      IInterception interception = null) where T : class
        {
            IApiRunner realSubject = GetInstace(model);

            return(ProxyFactory.CreateProxyInstance <ApiBase <T> >(realSubject, interception));
        }
示例#2
0
 public Program(ILog log, IApiRunner<JToken> jsonApiRunner, IApiRunner<XDocument> xmlApiRunner)
 {
     this.log = log;
     this.jsonApiRunner = jsonApiRunner;
     this.xmlApiRunner = xmlApiRunner;
 }
示例#3
0
        private void Run(IApiRunner<XDocument> runner, SampleSettings settings)
        {
            //1. You will need to login to the site to retrieve the token to use for authentication on the other requests
            runner.Login (settings);

            //2. Retrieve the list of racks (racks.xml)
            var collection = runner.RetrieveRackCollection (settings);
            WriteResults ("racks.xml", collection);

            //I am just using the id from the first rack
            if (collection == null) {
                return;
            }
            var token = collection.XPathSelectElement ("/assets/asset[position()=1]/id");
            if (token == null) {
                return;
            }
            var id = token.Value;

            //3. Retrieve the list of racks (rackContents.xml)
            var rackContentsResponse = runner.RetrieveRackContents (settings, id);

            WriteResults ("rackContents.xml", rackContentsResponse);

            //4. Retrieves the rack item (NLSRack.xml)
            var rackResponse = runner.RetrieveAsset (settings, id);
            WriteResults ("rack.xml", rackResponse);
        }