コード例 #1
0
        internal static void Main(string[] args)
        {
            Console.WriteLine("Content API for Shopping Command Line Sample");
            Console.WriteLine("============================================");

            var options = new Options();

            CommandLine.Parser.Default.ParseArgumentsStrict(args, options);

            if (options.ConfigPath == null)
            {
                options.ConfigPath = defaultPath;
            }

            MerchantConfig config = MerchantConfig.Load(options.ConfigPath);

            var initializer = Authenticator.authenticate(config, ShoppingContentService.Scope.Content);

            if (initializer == null)
            {
                Console.WriteLine("Failed to authenticate, so exiting.");
                return;
            }

            // Create the service.
            var service = new ShoppingContentService(new BaseClientService.Initializer()
            {
                HttpClientInitializer = initializer,
                ApplicationName       = config.ApplicationName,
            });

            AccountsSample        accountsSample        = new AccountsSample(service);
            AccountstatusesSample accountstatusesSample =
                new AccountstatusesSample(service, MaxListPageSize);
            AccounttaxSample      accounttaxSample      = new AccounttaxSample(service);
            DatafeedsSample       datafeedsSample       = new DatafeedsSample(service);
            ProductsSample        productsSample        = new ProductsSample(service, MaxListPageSize);
            ProductstatusesSample productstatusesSample =
                new ProductstatusesSample(service, MaxListPageSize);
            ShippingsettingsSample   shippingsettingsSample   = new ShippingsettingsSample(service);
            MultiClientAccountSample multiClientAccountSample = new MultiClientAccountSample(service);

            if (!config.IsMCA)
            {
                // Non-MCA calls
                productsSample.RunCalls(config.MerchantId, config.WebsiteURL);
                productstatusesSample.RunCalls(config.MerchantId);
                datafeedsSample.RunCalls(config.MerchantId);
                accountstatusesSample.RunCalls(config.MerchantId);
                accountsSample.RunCalls(config.MerchantId, config.AccountSampleUser, config.AccountSampleAdWordsCID);
                accounttaxSample.RunCalls(config.MerchantId);
                shippingsettingsSample.RunCalls(config.MerchantId);
            }
            else
            {
                // MCA calls
                accountstatusesSample.RunMultiCalls(config.MerchantId);
                multiClientAccountSample.RunCalls(config.MerchantId);
            }
        }
コード例 #2
0
        internal static void Main(string[] args)
        {
            Console.WriteLine("Content API for Shopping Orders Sample");
            Console.WriteLine("============================================");

            MerchantConfig config = MerchantConfig.Load();

            var initializer = Authenticator.authenticate(config, ShoppingContentService.Scope.Content);

            if (initializer == null)
            {
                Console.WriteLine("Failed to authenticate, so exiting.");
                return;
            }

            // Create the (sandbox-using) service.
            var service = new SandboxService(new BaseClientService.Initializer()
            {
                HttpClientInitializer = initializer,
                ApplicationName       = config.ApplicationName,
            });

            OrdersSample ordersSample = new OrdersSample(service);

            ordersSample.RunCalls(config.MerchantId);
        }
コード例 #3
0
 internal override void initializeConfig(bool noConfig)
 {
     if (noConfig)
     {
         config = new MerchantConfig();
     }
     else
     {
         config = MerchantConfig.Load(CliOptions.ConfigPath);
     }
 }
コード例 #4
0
 internal override void initializeConfig()
 {
     config = MerchantConfig.Load(CliOptions.ConfigPath);
 }