File: dataqualitysample.cs

package info (click to toggle)
gdata-sharp 2.2.0.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 12,092 kB
  • sloc: cs: 67,781; xml: 38,234; python: 163; makefile: 149; sh: 27
file content (54 lines) | stat: -rw-r--r-- 2,250 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Collections.Generic;
using Google.GData.ContentForShopping;
using Google.GData.ContentForShopping.Elements;
using Google.GData.Client;

namespace DataQualitySample {
    class DataQualityDemo {
        private static string username;
        private static string password;
        private static string accountId;
        private static string subaccount;

        /// <summary>
        /// This console application demonstrates all the Google
        /// Content for Shopping data quality API calls.
        /// </summary>
        /// <param name="args">Command-line arguments: args[0] is
        /// the username, args[1] is the password, args[2] is the account ID
        /// and args[3] is the subaccount ID.
        ///
        /// Example: DataQualityDemo admin@example.com my_password 123456 789012</param>
        public static void Main(string[] args) {
            if (args.Length != 4) {
                Console.WriteLine("Syntax: DataQualityDemo <username> <password> <account_id> <subaccount>");
            } else {
                username = args[0];
                password = args[1];
                accountId = args[2];
                subaccount = args[3];

                RunSample(username, password, accountId, subaccount);
            }
        }

        private static void RunSample(string username, string password, string accountId, string subaccount) {
            // Connect to the service
            ContentForShoppingService service = new ContentForShoppingService("DataQuality-Sample", accountId);
            service.setUserCredentials(username, password);

            // Retrieve the list of DQ feeds for first 25 subaccounts
            DataQualityFeed feed = service.QueryDataQualityFeed();

            // Display title for each entry in the feed
            Console.WriteLine("Listing all data quality feeds returned");
            foreach (DataQualityEntry m in feed.Entries) {
                Console.WriteLine("Entry Name: " + m.Title.Text);
            }

            DataQualityEntry entry = service.GetDataQualityEntry(subaccount);
            Console.WriteLine("Entry Name: " + entry.Title.Text);
        }
    }
}