Feed API customization class for defining Product feed.
Inheritance: Google.GData.Client.AbstractEntry
Exemplo n.º 1
0
        private static void RunSample(string username, string password, string accountId) {
            // Connect to the service
            ContentForShoppingService service = new ContentForShoppingService("Users-Sample", accountId);
            service.setUserCredentials(username, password);

            // Retrieve the list of all existing users
            UsersFeed feed = service.QueryUsers();

            // Display title and admin for each user
            Console.WriteLine("Listing all users returned");
            foreach (UsersEntry m in feed.Entries) {
                Console.WriteLine("User: "******" (" + m.Admin + ")");
            }

            // Create a new users entry
            UsersEntry entry = new UsersEntry();
            entry.Title.Text = "*****@*****.**";
            entry.Admin = false;
	        entry.Permissions.Add(new Permission("online", "readwrite"));
	        entry.Permissions.Add(new Permission("local", "noaccess"));

            // Add the user
            Console.WriteLine("Inserting user");
            UsersEntry inserted = service.InsertUser(entry);

            // Update the user we just inserted
            Console.WriteLine("Updating user");
            inserted.Permissions.Add(new Permission("online", "readonly"));
	        inserted.Permissions.Add(new Permission("local", "noaccess"));
            UsersEntry updated = service.UpdateUser(inserted);

            // Retrieve the new list of users
            feed = service.QueryUsers();

            // Display title and admin for each user
            Console.WriteLine("Listing all users returned");
            foreach (UsersEntry m in feed.Entries) {
                Console.WriteLine("User: "******" (" + m.Admin + ")");
            }

            // Delete the user we inserted and updated
            Console.WriteLine("Deleting user");
            service.DeleteUser(updated);
        }
 /// <summary>
 /// Deletes an existing user
 /// </summary>
 /// <param name="entry">the entry to delete</param>
 public void DeleteUser(UsersEntry entry)
 {
     base.Delete(entry);
 }
 /// <summary>
 /// Inserts a new users entry into the specified feed.
 /// </summary>
 /// <param name="feed">the feed into which this entry should be inserted</param>
 /// <param name="entry">the entry to insert</param>
 /// <returns>the inserted entry</returns>
 public UsersEntry InsertUser(UsersFeed feed, UsersEntry entry)
 {
     return base.Insert(feed, entry);
 }
 /// <summary>
 /// Updates an existing users entry with the new values
 /// </summary>
 /// <param name="entry">the entry to update</param>
 /// <returns>the updated entry returned by the server</returns>
 public UsersEntry UpdateUser(UsersEntry entry)
 {
     return base.Update(entry);
 }
 /// <summary>
 /// Inserts a new users entry.
 /// </summary>
 /// <param name="entry">the entry to insert</param>
 /// <returns>the inserted entry</returns>
 public UsersEntry InsertUser(UsersEntry entry)
 {
     return base.Insert(CreateUri("users", null), entry) as UsersEntry;
 }
 /// <summary>
 /// Inserts a new user entry.
 /// </summary>
 /// <param name="entry">the entry to insert</param>
 /// <param name="accountId">The ID of the account where the user will have privileges.</param>
 /// <returns>the inserted entry</returns>
 public UsersEntry InsertUser(UsersEntry entry, string accountId)
 {
     return base.Insert(CreateUri(accountId, "users", null, null), entry);
 }
 /// <summary>
 /// Deletes an existing user
 /// </summary>
 /// <param name="entry">the entry to delete</param>
 public void DeleteUser(UsersEntry entry)
 {
     base.Delete(entry);
 }
 /// <summary>
 /// Updates an existing users entry with the new values
 /// </summary>
 /// <param name="entry">the entry to update</param>
 /// <returns>the updated entry returned by the server</returns>
 public UsersEntry UpdateUser(UsersEntry entry)
 {
     return(base.Update(entry));
 }
 /// <summary>
 /// Inserts a new users entry into the specified feed.
 /// </summary>
 /// <param name="feed">the feed into which this entry should be inserted</param>
 /// <param name="entry">the entry to insert</param>
 /// <returns>the inserted entry</returns>
 public UsersEntry InsertUser(UsersFeed feed, UsersEntry entry)
 {
     return(base.Insert(feed, entry));
 }
 /// <summary>
 /// Inserts a new user entry.
 /// </summary>
 /// <param name="entry">the entry to insert</param>
 /// <param name="accountId">The ID of the account where the user will have privileges.</param>
 /// <returns>the inserted entry</returns>
 public UsersEntry InsertUser(UsersEntry entry, string accountId)
 {
     return(base.Insert(CreateUri(accountId, "users", null, null), entry));
 }
 /// <summary>
 /// Inserts a new users entry.
 /// </summary>
 /// <param name="entry">the entry to insert</param>
 /// <returns>the inserted entry</returns>
 public UsersEntry InsertUser(UsersEntry entry)
 {
     return(base.Insert(CreateUri("users", null), entry) as UsersEntry);
 }