context: // gShell is licensed under the GNU GENERAL PUBLIC LICENSE, Version 3
  //
  // http://www.gnu.org/licenses/gpl-3.0.en.html
  //
  // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
  // an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
  // specific language governing permissions and limitations under the License.
  //
  // gShell is based upon https://github.com/google/google-api-dotnet-client, which is licensed under the Apache 2.0
  // license: https://github.com/google/google-api-dotnet-client/blob/master/LICENSE
  //
  // gShell is reliant upon the Google Apis. Please see the specific API pages for specific licensing information.
  
  //------------------------------------------------------------------------------
  // <auto-generated>
  //     This code was generated by a fork of google-apis-code-generator:
  //       https://github.com/squid808/apis-client-generator
  //
  //     How neat is that? Pretty neat.
  //
  //     Changes to this file may cause incorrect behavior and will be lost if
  //     the code is regenerated.
  // </auto-generated>
  //------------------------------------------------------------------------------
  
  using gShell.Cmdlets.Utilities.OAuth2;
  using gShell.dotNet;
  
  namespace gShell.Cmdlets.Gmail{
  
      using System;
      using System.Collections.Generic;
      using System.Management.Automation;
  
      using Google.Apis.Auth.OAuth2;
      using Google.Apis.Services;
      using v1 = Google.Apis.Gmail.v1;
      using Data = Google.Apis.Gmail.v1.Data;
  
      using gShell.dotNet.Utilities;
      using gShell.dotNet.Utilities.OAuth2;
      using gGmail = gShell.dotNet.Gmail;
  
      /// <summary>
      /// A PowerShell-ready wrapper for the Gmail api, as well as the resources and methods therein.
      /// </summary>
      public abstract class GmailBase : ServiceAccountCmdletBase
      {
  
          #region Properties
  
          /// <summary>The gShell dotNet class wrapper base.</summary>
          protected static gGmail mainBase { get; set; }
  
  
          /// <summary>An instance of the Users gShell dotNet resource.</summary>
          public Users users { get; set; }
  
          /// <summary>
          /// Required to be able to store and retrieve the mainBase from the ServiceWrapperDictionary
          /// </summary>
          protected override Type mainBaseType { get { return typeof(gGmail); } }
          #endregion
  
          #region Constructors
          protected GmailBase()
          {
              mainBase = new gGmail();
  
              ServiceWrapperDictionary[mainBaseType] = mainBase;
  
  
              users = new Users();
          }
          #endregion
  
          #region Wrapped Methods
  
  
  
          #region Users
  
          /// <summary>A wrapper class for the Users resource.</summary>
          public class Users
          {
  
  
              /// <summary>Gets or sets the  subresource.</summary>
  
              public Drafts drafts{ get; set; }
  
              /// <summary>Gets or sets the  subresource.</summary>
  
              public History history{ get; set; }
  
              /// <summary>Gets or sets the  subresource.</summary>
  
              public Labels labels{ get; set; }
  
              /// <summary>Gets or sets the  subresource.</summary>
  
              public Messages messages{ get; set; }
  
              /// <summary>Gets or sets the  subresource.</summary>
  
              public Settings settings{ get; set; }
  
              /// <summary>Gets or sets the  subresource.</summary>
  
              public Threads threads{ get; set; }
  
              /// <summary>Constructs a new Users resource.</summary>
              public Users()
              {
  
                  drafts = new Drafts();
                  history = new History();
                  labels = new Labels();
                  messages = new Messages();
                  settings = new Settings();
                  threads = new Threads();
              }
  
              #region Drafts
  
              /// <summary>A wrapper class for the Drafts resource.</summary>
              public class Drafts
              {
  
  
  
  
                  /// <summary>Creates a new draft with the DRAFT label.</summary>
                  /// <param name="DraftBody">The body of the request.</param>
                  /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                  /// user.</param>
                  public Google.Apis.Gmail.v1.Data.Draft Create (Google.Apis.Gmail.v1.Data.Draft DraftBody, string UserId, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      return mainBase.users.drafts.Create(DraftBody, UserId, ServiceAccount, StandardQueryParams);
                  }
  
  
                  /// <summary>3</summary>
                  public void Create (Google.Apis.Gmail.v1.Data.Draft DraftBody, string userId, System.IO.Stream stream, string contentType, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      mainBase.users.drafts.Create(DraftBody, userId, stream, contentType, ServiceAccount, StandardQueryParams);
                  }
  
                  /// <summary>Immediately and permanently deletes the specified draft. Does not simply trash
                  /// it.</summary>
                  /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                  /// user.</param>
                  /// <param name="Id">The ID of the draft to delete.</param>
                  public void Delete (string UserId, string Id, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      mainBase.users.drafts.Delete(UserId, Id, ServiceAccount, StandardQueryParams);
                  }
  
  
  
                  /// <summary>Gets the specified draft.</summary>
                  /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                  /// user.</param>
                  /// <param name="Id">The ID of the draft to retrieve.</param>
                  /// <param name="properties">The optional properties for this method.</param>
                  public Google.Apis.Gmail.v1.Data.Draft Get (string UserId, string Id, gGmail.Users.Drafts.DraftsGetProperties properties= null, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      properties = properties ?? new gGmail.Users.Drafts.DraftsGetProperties();
  
                      return mainBase.users.drafts.Get(UserId, Id, properties, ServiceAccount, StandardQueryParams);
                  }
  
  
  
                  /// <summary>Lists the drafts in the user's mailbox.</summary>
                  /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                  /// user.</param>
                  /// <param name="properties">The optional properties for this method.</param>
  
                  public List<Google.Apis.Gmail.v1.Data.ListDraftsResponse> List(string UserId, gGmail.Users.Drafts.DraftsListProperties properties= null, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      properties = properties ?? new gGmail.Users.Drafts.DraftsListProperties();
                      properties.StartProgressBar = StartProgressBar;
                      properties.UpdateProgressBar = UpdateProgressBar;
  
                      return mainBase.users.drafts.List(UserId, properties, ServiceAccount, StandardQueryParams);
                  }
  
                  /// <summary>Sends the specified, existing draft to the recipients in the To, Cc, and Bcc
                  /// headers.</summary>
                  /// <param name="DraftBody">The body of the request.</param>
                  /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                  /// user.</param>
                  public Google.Apis.Gmail.v1.Data.Message Send (Google.Apis.Gmail.v1.Data.Draft DraftBody, string UserId, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      return mainBase.users.drafts.Send(DraftBody, UserId, ServiceAccount, StandardQueryParams);
                  }
  
  
                  /// <summary>3</summary>
                  public void Send (Google.Apis.Gmail.v1.Data.Draft DraftBody, string userId, System.IO.Stream stream, string contentType, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      mainBase.users.drafts.Send(DraftBody, userId, stream, contentType, ServiceAccount, StandardQueryParams);
                  }
  
                  /// <summary>Replaces a draft's content.</summary>
                  /// <param name="DraftBody">The body of the request.</param>
                  /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                  /// user.</param>
                  /// <param name="Id">The ID of the draft to update.</param>
                  public Google.Apis.Gmail.v1.Data.Draft Update (Google.Apis.Gmail.v1.Data.Draft DraftBody, string UserId, string Id, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      return mainBase.users.drafts.Update(DraftBody, UserId, Id, ServiceAccount, StandardQueryParams);
                  }
  
  
                  /// <summary>3</summary>
                  public void Update (Google.Apis.Gmail.v1.Data.Draft DraftBody, string userId, string id, System.IO.Stream stream, string contentType, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      mainBase.users.drafts.Update(DraftBody, userId, id, stream, contentType, ServiceAccount, StandardQueryParams);
                  }
              }
              #endregion
              #region History
  
              /// <summary>A wrapper class for the History resource.</summary>
              public class History
              {
  
  
  
  
                  /// <summary>Lists the history of all changes to the given mailbox. History results are returned in
                  /// chronological order (increasing historyId).</summary>
                  /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                  /// user.</param>
                  /// <param name="properties">The optional properties for this method.</param>
  
                  public List<Google.Apis.Gmail.v1.Data.ListHistoryResponse> List(string UserId, gGmail.Users.History.HistoryListProperties properties= null, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      properties = properties ?? new gGmail.Users.History.HistoryListProperties();
                      properties.StartProgressBar = StartProgressBar;
                      properties.UpdateProgressBar = UpdateProgressBar;
  
                      return mainBase.users.history.List(UserId, properties, ServiceAccount, StandardQueryParams);
                  }
              }
              #endregion
              #region Labels
  
              /// <summary>A wrapper class for the Labels resource.</summary>
              public class Labels
              {
  
  
  
  
                  /// <summary>Creates a new label.</summary>
                  /// <param name="LabelBody">The body of the request.</param>
                  /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                  /// user.</param>
                  public Google.Apis.Gmail.v1.Data.Label Create (Google.Apis.Gmail.v1.Data.Label LabelBody, string UserId, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      return mainBase.users.labels.Create(LabelBody, UserId, ServiceAccount, StandardQueryParams);
                  }
  
  
  
                  /// <summary>Immediately and permanently deletes the specified label and removes it from any messages
                  /// and threads that it is applied to.</summary>
                  /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                  /// user.</param>
                  /// <param name="Id">The ID of the label to delete.</param>
                  public void Delete (string UserId, string Id, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      mainBase.users.labels.Delete(UserId, Id, ServiceAccount, StandardQueryParams);
                  }
  
  
  
                  /// <summary>Gets the specified label.</summary>
                  /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                  /// user.</param>
                  /// <param name="Id">The ID of the label to retrieve.</param>
                  public Google.Apis.Gmail.v1.Data.Label Get (string UserId, string Id, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      return mainBase.users.labels.Get(UserId, Id, ServiceAccount, StandardQueryParams);
                  }
  
  
  
                  /// <summary>Lists all labels in the user's mailbox.</summary>
                  /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                  /// user.</param>
                  public Google.Apis.Gmail.v1.Data.ListLabelsResponse List (string UserId, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      return mainBase.users.labels.List(UserId, ServiceAccount, StandardQueryParams);
                  }
  
  
  
                  /// <summary>Updates the specified label. This method supports patch semantics.</summary>
                  /// <param name="LabelBody">The body of the request.</param>
                  /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                  /// user.</param>
                  /// <param name="Id">The ID of the label to update.</param>
                  public Google.Apis.Gmail.v1.Data.Label Patch (Google.Apis.Gmail.v1.Data.Label LabelBody, string UserId, string Id, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      return mainBase.users.labels.Patch(LabelBody, UserId, Id, ServiceAccount, StandardQueryParams);
                  }
  
  
  
                  /// <summary>Updates the specified label.</summary>
                  /// <param name="LabelBody">The body of the request.</param>
                  /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                  /// user.</param>
                  /// <param name="Id">The ID of the label to update.</param>
                  public Google.Apis.Gmail.v1.Data.Label Update (Google.Apis.Gmail.v1.Data.Label LabelBody, string UserId, string Id, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      return mainBase.users.labels.Update(LabelBody, UserId, Id, ServiceAccount, StandardQueryParams);
                  }
  
  
              }
              #endregion
              #region Messages
  
              /// <summary>A wrapper class for the Messages resource.</summary>
              public class Messages
              {
  
  
                  /// <summary>Gets or sets the  subresource.</summary>
  
                  public Attachments attachments{ get; set; }
  
                  /// <summary>Constructs a new Messages resource.</summary>
                  public Messages()
                  {
  
                      attachments = new Attachments();
                  }
  
                  #region Attachments
  
                  /// <summary>A wrapper class for the Attachments resource.</summary>
                  public class Attachments
                  {
  
  
  
  
                      /// <summary>Gets the specified message attachment.</summary>
                      /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                      /// user.</param>
                      /// <param name="MessageId">The ID of the message containing the attachment.</param>
                      ///
                      /// <param name="Id">The ID of the attachment.</param>
                      public Google.Apis.Gmail.v1.Data.MessagePartBody Get (string UserId, string MessageId, string Id, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                      {
  
                          return mainBase.users.messages.attachments.Get(UserId, MessageId, Id, ServiceAccount, StandardQueryParams);
                      }
  
  
                  }
                  #endregion
  
  
                  /// <summary>Deletes many messages by message ID. Provides no guarantees that messages were not already
                  /// deleted or even existed at all.</summary>
                  /// <param name="BatchDeleteMessagesRequestBody">The body of the request.</param>
                  /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                  /// user.</param>
                  public void BatchDelete (Google.Apis.Gmail.v1.Data.BatchDeleteMessagesRequest BatchDeleteMessagesRequestBody, string UserId, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      mainBase.users.messages.BatchDelete(BatchDeleteMessagesRequestBody, UserId, ServiceAccount, StandardQueryParams);
                  }
  
  
  
                  /// <summary>Modifies the labels on the specified messages.</summary>
                  /// <param name="BatchModifyMessagesRequestBody">The body of the request.</param>
                  /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                  /// user.</param>
                  public void BatchModify (Google.Apis.Gmail.v1.Data.BatchModifyMessagesRequest BatchModifyMessagesRequestBody, string UserId, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      mainBase.users.messages.BatchModify(BatchModifyMessagesRequestBody, UserId, ServiceAccount, StandardQueryParams);
                  }
  
  
  
                  /// <summary>Immediately and permanently deletes the specified message. This operation cannot be undone.
                  /// Prefer messages.trash instead.</summary>
                  /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                  /// user.</param>
                  /// <param name="Id">The ID of the message to delete.</param>
                  public void Delete (string UserId, string Id, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      mainBase.users.messages.Delete(UserId, Id, ServiceAccount, StandardQueryParams);
                  }
  
  
  
                  /// <summary>Gets the specified message.</summary>
                  /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                  /// user.</param>
                  /// <param name="Id">The ID of the message to retrieve.</param>
                  /// <param name="properties">The optional properties for this method.</param>
                  public Google.Apis.Gmail.v1.Data.Message Get (string UserId, string Id, gGmail.Users.Messages.MessagesGetProperties properties= null, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      properties = properties ?? new gGmail.Users.Messages.MessagesGetProperties();
  
                      return mainBase.users.messages.Get(UserId, Id, properties, ServiceAccount, StandardQueryParams);
                  }
  
  
  
                  /// <summary>Imports a message into only this user's mailbox, with standard email delivery scanning and
                  /// classification similar to receiving via SMTP. Does not send a message.</summary>
                  /// <param name="MessageBody">The body of the request.</param>
                  /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                  /// user.</param>
                  /// <param name="properties">The optional properties for this method.</param>
                  public Google.Apis.Gmail.v1.Data.Message Import (Google.Apis.Gmail.v1.Data.Message MessageBody, string UserId, gGmail.Users.Messages.MessagesImportProperties properties= null, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      properties = properties ?? new gGmail.Users.Messages.MessagesImportProperties();
  
                      return mainBase.users.messages.Import(MessageBody, UserId, properties, ServiceAccount, StandardQueryParams);
                  }
  
  
                  /// <summary>3</summary>
                  public void Import (Google.Apis.Gmail.v1.Data.Message MessageBody, string userId, System.IO.Stream stream, string contentType, gGmail.Users.Messages.MessagesImportUploadProperties properties= null, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      properties = properties ?? new gGmail.Users.Messages.MessagesImportUploadProperties();
  
                      mainBase.users.messages.Import(MessageBody, userId, stream, contentType, properties, ServiceAccount, StandardQueryParams);
                  }
  
                  /// <summary>Directly inserts a message into only this user's mailbox similar to IMAP APPEND, bypassing
                  /// most scanning and classification. Does not send a message.</summary>
                  /// <param name="MessageBody">The body of the request.</param>
                  /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                  /// user.</param>
                  /// <param name="properties">The optional properties for this method.</param>
                  public Google.Apis.Gmail.v1.Data.Message Insert (Google.Apis.Gmail.v1.Data.Message MessageBody, string UserId, gGmail.Users.Messages.MessagesInsertProperties properties= null, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      properties = properties ?? new gGmail.Users.Messages.MessagesInsertProperties();
  
                      return mainBase.users.messages.Insert(MessageBody, UserId, properties, ServiceAccount, StandardQueryParams);
                  }
  
  
                  /// <summary>3</summary>
                  public void Insert (Google.Apis.Gmail.v1.Data.Message MessageBody, string userId, System.IO.Stream stream, string contentType, gGmail.Users.Messages.MessagesInsertUploadProperties properties= null, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      properties = properties ?? new gGmail.Users.Messages.MessagesInsertUploadProperties();
  
                      mainBase.users.messages.Insert(MessageBody, userId, stream, contentType, properties, ServiceAccount, StandardQueryParams);
                  }
  
                  /// <summary>Lists the messages in the user's mailbox.</summary>
                  /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                  /// user.</param>
                  /// <param name="properties">The optional properties for this method.</param>
  
                  public List<Google.Apis.Gmail.v1.Data.ListMessagesResponse> List(string UserId, gGmail.Users.Messages.MessagesListProperties properties= null, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      properties = properties ?? new gGmail.Users.Messages.MessagesListProperties();
                      properties.StartProgressBar = StartProgressBar;
                      properties.UpdateProgressBar = UpdateProgressBar;
  
                      return mainBase.users.messages.List(UserId, properties, ServiceAccount, StandardQueryParams);
                  }
  
                  /// <summary>Modifies the labels on the specified message.</summary>
                  /// <param name="ModifyMessageRequestBody">The body of the request.</param>
                  /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                  /// user.</param>
                  /// <param name="Id">The ID of the message to modify.</param>
                  public Google.Apis.Gmail.v1.Data.Message Modify (Google.Apis.Gmail.v1.Data.ModifyMessageRequest ModifyMessageRequestBody, string UserId, string Id, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      return mainBase.users.messages.Modify(ModifyMessageRequestBody, UserId, Id, ServiceAccount, StandardQueryParams);
                  }
  
  
  
                  /// <summary>Sends the specified message to the recipients in the To, Cc, and Bcc headers.</summary>
                  /// <param name="MessageBody">The body of the request.</param>
                  /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                  /// user.</param>
                  public Google.Apis.Gmail.v1.Data.Message Send (Google.Apis.Gmail.v1.Data.Message MessageBody, string UserId, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      return mainBase.users.messages.Send(MessageBody, UserId, ServiceAccount, StandardQueryParams);
                  }
  
  
                  /// <summary>3</summary>
                  public void Send (Google.Apis.Gmail.v1.Data.Message MessageBody, string userId, System.IO.Stream stream, string contentType, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      mainBase.users.messages.Send(MessageBody, userId, stream, contentType, ServiceAccount, StandardQueryParams);
                  }
  
                  /// <summary>Moves the specified message to the trash.</summary>
                  /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                  /// user.</param>
                  /// <param name="Id">The ID of the message to Trash.</param>
                  public Google.Apis.Gmail.v1.Data.Message Trash (string UserId, string Id, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      return mainBase.users.messages.Trash(UserId, Id, ServiceAccount, StandardQueryParams);
                  }
  
  
  
                  /// <summary>Removes the specified message from the trash.</summary>
                  /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                  /// user.</param>
                  /// <param name="Id">The ID of the message to remove from Trash.</param>
                  public Google.Apis.Gmail.v1.Data.Message Untrash (string UserId, string Id, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      return mainBase.users.messages.Untrash(UserId, Id, ServiceAccount, StandardQueryParams);
                  }
  
  
              }
              #endregion
              #region Settings
  
              /// <summary>A wrapper class for the Settings resource.</summary>
              public class Settings
              {
  
  
                  /// <summary>Gets or sets the  subresource.</summary>
  
                  public Filters filters{ get; set; }
  
                  /// <summary>Gets or sets the  subresource.</summary>
  
                  public ForwardingAddresses forwardingAddresses{ get; set; }
  
                  /// <summary>Gets or sets the  subresource.</summary>
  
                  public SendAs sendAs{ get; set; }
  
                  /// <summary>Constructs a new Settings resource.</summary>
                  public Settings()
                  {
  
                      filters = new Filters();
                      forwardingAddresses = new ForwardingAddresses();
                      sendAs = new SendAs();
                  }
  
                  #region Filters
  
                  /// <summary>A wrapper class for the Filters resource.</summary>
                  public class Filters
                  {
  
  
  
  
                      /// <summary>Creates a filter.</summary>
                      /// <param name="FilterBody">The body of the request.</param>
                      /// <param name="UserId">User's email address. The special value "me" can be used to indicate the authenticated
                      /// user.</param>
                      public Google.Apis.Gmail.v1.Data.Filter Create (Google.Apis.Gmail.v1.Data.Filter FilterBody, string UserId, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                      {
  
                          return mainBase.users.settings.filters.Create(FilterBody, UserId, ServiceAccount, StandardQueryParams);
                      }
  
  
  
                      /// <summary>Deletes a filter.</summary>
                      /// <param name="UserId">User's email address. The special value "me" can be used to indicate the authenticated
                      /// user.</param>
                      /// <param name="Id">The ID of the filter to be deleted.</param>
                      public void Delete (string UserId, string Id, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                      {
  
                          mainBase.users.settings.filters.Delete(UserId, Id, ServiceAccount, StandardQueryParams);
                      }
  
  
  
                      /// <summary>Gets a filter.</summary>
                      /// <param name="UserId">User's email address. The special value "me" can be used to indicate the authenticated
                      /// user.</param>
                      /// <param name="Id">The ID of the filter to be fetched.</param>
                      public Google.Apis.Gmail.v1.Data.Filter Get (string UserId, string Id, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                      {
  
                          return mainBase.users.settings.filters.Get(UserId, Id, ServiceAccount, StandardQueryParams);
                      }
  
  
  
                      /// <summary>Lists the message filters of a Gmail user.</summary>
                      /// <param name="UserId">User's email address. The special value "me" can be used to indicate the authenticated
                      /// user.</param>
                      public Google.Apis.Gmail.v1.Data.ListFiltersResponse List (string UserId, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                      {
  
                          return mainBase.users.settings.filters.List(UserId, ServiceAccount, StandardQueryParams);
                      }
  
  
                  }
                  #endregion
                  #region ForwardingAddresses
  
                  /// <summary>A wrapper class for the ForwardingAddresses resource.</summary>
                  public class ForwardingAddresses
                  {
  
  
  
  
                      /// <summary>Creates a forwarding address. If ownership verification is required, a message will be
                      /// sent to the recipient and the resource's verification status will be set to pending; otherwise,
                      /// the resource will be created with verification status set to accepted.</summary>
                      /// <param name="ForwardingAddressBody">The body of the request.</param>
                      /// <param name="UserId">User's email address. The special value "me" can be used to indicate the authenticated
                      /// user.</param>
                      public Google.Apis.Gmail.v1.Data.ForwardingAddress Create (Google.Apis.Gmail.v1.Data.ForwardingAddress ForwardingAddressBody, string UserId, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                      {
  
                          return mainBase.users.settings.forwardingAddresses.Create(ForwardingAddressBody, UserId, ServiceAccount, StandardQueryParams);
                      }
  
  
  
                      /// <summary>Deletes the specified forwarding address and revokes any verification that may have
                      /// been required.</summary>
                      /// <param name="UserId">User's email address. The special value "me" can be used to indicate the authenticated
                      /// user.</param>
                      /// <param name="ForwardingEmail">The forwarding address to be deleted.</param>
                      public void Delete (string UserId, string ForwardingEmail, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                      {
  
                          mainBase.users.settings.forwardingAddresses.Delete(UserId, ForwardingEmail, ServiceAccount, StandardQueryParams);
                      }
  
  
  
                      /// <summary>Gets the specified forwarding address.</summary>
                      /// <param name="UserId">User's email address. The special value "me" can be used to indicate the authenticated
                      /// user.</param>
                      /// <param name="ForwardingEmail">The forwarding address to be retrieved.</param>
                      public Google.Apis.Gmail.v1.Data.ForwardingAddress Get (string UserId, string ForwardingEmail, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                      {
  
                          return mainBase.users.settings.forwardingAddresses.Get(UserId, ForwardingEmail, ServiceAccount, StandardQueryParams);
                      }
  
  
  
                      /// <summary>Lists the forwarding addresses for the specified account.</summary>
                      /// <param name="UserId">User's email address. The special value "me" can be used to indicate the authenticated
                      /// user.</param>
                      public Google.Apis.Gmail.v1.Data.ListForwardingAddressesResponse List (string UserId, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                      {
  
                          return mainBase.users.settings.forwardingAddresses.List(UserId, ServiceAccount, StandardQueryParams);
                      }
  
  
                  }
                  #endregion
                  #region SendAs
  
                  /// <summary>A wrapper class for the SendAs resource.</summary>
                  public class SendAs
                  {
  
  
  
  
                      /// <summary>Creates a custom "from" send-as alias. If an SMTP MSA is specified, Gmail will attempt
                      /// to connect to the SMTP service to validate the configuration before creating the alias. If
                      /// ownership verification is required for the alias, a message will be sent to the email address
                      /// and the resource's verification status will be set to pending; otherwise, the resource will be
                      /// created with verification status set to accepted. If a signature is provided, Gmail will
                      /// sanitize the HTML before saving it with the alias.</summary>
                      /// <param name="SendAsBody">The body of the request.</param>
                      /// <param name="UserId">User's email address. The special value "me" can be used to indicate the authenticated
                      /// user.</param>
                      public Google.Apis.Gmail.v1.Data.SendAs Create (Google.Apis.Gmail.v1.Data.SendAs SendAsBody, string UserId, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                      {
  
                          return mainBase.users.settings.sendAs.Create(SendAsBody, UserId, ServiceAccount, StandardQueryParams);
                      }
  
  
  
                      /// <summary>Deletes the specified send-as alias. Revokes any verification that may have been
                      /// required for using it.</summary>
                      /// <param name="UserId">User's email address. The special value "me" can be used to indicate the authenticated
                      /// user.</param>
                      /// <param name="SendAsEmail">The send-as alias to be deleted.</param>
                      public void Delete (string UserId, string SendAsEmail, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                      {
  
                          mainBase.users.settings.sendAs.Delete(UserId, SendAsEmail, ServiceAccount, StandardQueryParams);
                      }
  
  
  
                      /// <summary>Gets the specified send-as alias. Fails with an HTTP 404 error if the specified address
                      /// is not a member of the collection.</summary>
                      /// <param name="UserId">User's email address. The special value "me" can be used to indicate the authenticated
                      /// user.</param>
                      /// <param name="SendAsEmail">The send-as alias to be retrieved.</param>
                      public Google.Apis.Gmail.v1.Data.SendAs Get (string UserId, string SendAsEmail, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                      {
  
                          return mainBase.users.settings.sendAs.Get(UserId, SendAsEmail, ServiceAccount, StandardQueryParams);
                      }
  
  
  
                      /// <summary>Lists the send-as aliases for the specified account. The result includes the primary
                      /// send-as address associated with the account as well as any custom "from" aliases.</summary>
                      /// <param name="UserId">User's email address. The special value "me" can be used to indicate the authenticated
                      /// user.</param>
                      public Google.Apis.Gmail.v1.Data.ListSendAsResponse List (string UserId, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                      {
  
                          return mainBase.users.settings.sendAs.List(UserId, ServiceAccount, StandardQueryParams);
                      }
  
  
  
                      /// <summary>Updates a send-as alias. If a signature is provided, Gmail will sanitize the HTML
                      /// before saving it with the alias. This method supports patch semantics.</summary>
                      /// <param name="SendAsBody">The body of the request.</param>
                      /// <param name="UserId">User's email address. The special value "me" can be used to indicate the authenticated
                      /// user.</param>
                      /// <param name="SendAsEmail">The send-as alias to be updated.</param>
                      public Google.Apis.Gmail.v1.Data.SendAs Patch (Google.Apis.Gmail.v1.Data.SendAs SendAsBody, string UserId, string SendAsEmail, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                      {
  
                          return mainBase.users.settings.sendAs.Patch(SendAsBody, UserId, SendAsEmail, ServiceAccount, StandardQueryParams);
                      }
  
  
  
                      /// <summary>Updates a send-as alias. If a signature is provided, Gmail will sanitize the HTML
                      /// before saving it with the alias.</summary>
                      /// <param name="SendAsBody">The body of the request.</param>
                      /// <param name="UserId">User's email address. The special value "me" can be used to indicate the authenticated
                      /// user.</param>
                      /// <param name="SendAsEmail">The send-as alias to be updated.</param>
                      public Google.Apis.Gmail.v1.Data.SendAs Update (Google.Apis.Gmail.v1.Data.SendAs SendAsBody, string UserId, string SendAsEmail, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                      {
  
                          return mainBase.users.settings.sendAs.Update(SendAsBody, UserId, SendAsEmail, ServiceAccount, StandardQueryParams);
                      }
  
  
  
                      /// <summary>Sends a verification email to the specified send-as alias address. The verification
                      /// status must be pending.</summary>
                      /// <param name="UserId">User's email address. The special value "me" can be used to indicate the authenticated
                      /// user.</param>
                      /// <param name="SendAsEmail">The send-as alias to be verified.</param>
                      public void Verify (string UserId, string SendAsEmail, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                      {
  
                          mainBase.users.settings.sendAs.Verify(UserId, SendAsEmail, ServiceAccount, StandardQueryParams);
                      }
  
  
                  }
                  #endregion
  
  
                  /// <summary>Gets the auto-forwarding setting for the specified account.</summary>
                  /// <param name="UserId">User's email address. The special value "me" can be used to indicate the authenticated
                  /// user.</param>
                  public Google.Apis.Gmail.v1.Data.AutoForwarding GetAutoForwarding (string UserId, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      return mainBase.users.settings.GetAutoForwarding(UserId, ServiceAccount, StandardQueryParams);
                  }
  
  
  
                  /// <summary>Gets IMAP settings.</summary>
                  /// <param name="UserId">User's email address. The special value "me" can be used to indicate the authenticated
                  /// user.</param>
                  public Google.Apis.Gmail.v1.Data.ImapSettings GetImap (string UserId, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      return mainBase.users.settings.GetImap(UserId, ServiceAccount, StandardQueryParams);
                  }
  
  
  
                  /// <summary>Gets POP settings.</summary>
                  /// <param name="UserId">User's email address. The special value "me" can be used to indicate the authenticated
                  /// user.</param>
                  public Google.Apis.Gmail.v1.Data.PopSettings GetPop (string UserId, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      return mainBase.users.settings.GetPop(UserId, ServiceAccount, StandardQueryParams);
                  }
  
  
  
                  /// <summary>Gets vacation responder settings.</summary>
                  /// <param name="UserId">User's email address. The special value "me" can be used to indicate the authenticated
                  /// user.</param>
                  public Google.Apis.Gmail.v1.Data.VacationSettings GetVacation (string UserId, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      return mainBase.users.settings.GetVacation(UserId, ServiceAccount, StandardQueryParams);
                  }
  
  
  
                  /// <summary>Updates the auto-forwarding setting for the specified account. A verified forwarding
                  /// address must be specified when auto-forwarding is enabled.</summary>
                  /// <param name="AutoForwardingBody">The body of the request.</param>
                  /// <param name="UserId">User's email address. The special value "me" can be used to indicate the authenticated
                  /// user.</param>
                  public Google.Apis.Gmail.v1.Data.AutoForwarding UpdateAutoForwarding (Google.Apis.Gmail.v1.Data.AutoForwarding AutoForwardingBody, string UserId, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      return mainBase.users.settings.UpdateAutoForwarding(AutoForwardingBody, UserId, ServiceAccount, StandardQueryParams);
                  }
  
  
  
                  /// <summary>Updates IMAP settings.</summary>
                  /// <param name="ImapSettingsBody">The body of the request.</param>
                  /// <param name="UserId">User's email address. The special value "me" can be used to indicate the authenticated
                  /// user.</param>
                  public Google.Apis.Gmail.v1.Data.ImapSettings UpdateImap (Google.Apis.Gmail.v1.Data.ImapSettings ImapSettingsBody, string UserId, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      return mainBase.users.settings.UpdateImap(ImapSettingsBody, UserId, ServiceAccount, StandardQueryParams);
                  }
  
  
  
                  /// <summary>Updates POP settings.</summary>
                  /// <param name="PopSettingsBody">The body of the request.</param>
                  /// <param name="UserId">User's email address. The special value "me" can be used to indicate the authenticated
                  /// user.</param>
                  public Google.Apis.Gmail.v1.Data.PopSettings UpdatePop (Google.Apis.Gmail.v1.Data.PopSettings PopSettingsBody, string UserId, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      return mainBase.users.settings.UpdatePop(PopSettingsBody, UserId, ServiceAccount, StandardQueryParams);
                  }
  
  
  
                  /// <summary>Updates vacation responder settings.</summary>
                  /// <param name="VacationSettingsBody">The body of the request.</param>
                  /// <param name="UserId">User's email address. The special value "me" can be used to indicate the authenticated
                  /// user.</param>
                  public Google.Apis.Gmail.v1.Data.VacationSettings UpdateVacation (Google.Apis.Gmail.v1.Data.VacationSettings VacationSettingsBody, string UserId, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      return mainBase.users.settings.UpdateVacation(VacationSettingsBody, UserId, ServiceAccount, StandardQueryParams);
                  }
  
  
              }
              #endregion
              #region Threads
  
              /// <summary>A wrapper class for the Threads resource.</summary>
              public class Threads
              {
  
  
  
  
                  /// <summary>Immediately and permanently deletes the specified thread. This operation cannot be undone.
                  /// Prefer threads.trash instead.</summary>
                  /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                  /// user.</param>
                  /// <param name="Id">ID of the Thread to delete.</param>
                  public void Delete (string UserId, string Id, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      mainBase.users.threads.Delete(UserId, Id, ServiceAccount, StandardQueryParams);
                  }
  
  
  
                  /// <summary>Gets the specified thread.</summary>
                  /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                  /// user.</param>
                  /// <param name="Id">The ID of the thread to retrieve.</param>
                  /// <param name="properties">The optional properties for this method.</param>
                  public Google.Apis.Gmail.v1.Data.Thread Get (string UserId, string Id, gGmail.Users.Threads.ThreadsGetProperties properties= null, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      properties = properties ?? new gGmail.Users.Threads.ThreadsGetProperties();
  
                      return mainBase.users.threads.Get(UserId, Id, properties, ServiceAccount, StandardQueryParams);
                  }
  
  
  
                  /// <summary>Lists the threads in the user's mailbox.</summary>
                  /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                  /// user.</param>
                  /// <param name="properties">The optional properties for this method.</param>
  
                  public List<Google.Apis.Gmail.v1.Data.ListThreadsResponse> List(string UserId, gGmail.Users.Threads.ThreadsListProperties properties= null, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      properties = properties ?? new gGmail.Users.Threads.ThreadsListProperties();
                      properties.StartProgressBar = StartProgressBar;
                      properties.UpdateProgressBar = UpdateProgressBar;
  
                      return mainBase.users.threads.List(UserId, properties, ServiceAccount, StandardQueryParams);
                  }
  
                  /// <summary>Modifies the labels applied to the thread. This applies to all messages in the
                  /// thread.</summary>
                  /// <param name="ModifyThreadRequestBody">The body of the request.</param>
                  /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                  /// user.</param>
                  /// <param name="Id">The ID of the thread to modify.</param>
                  public Google.Apis.Gmail.v1.Data.Thread Modify (Google.Apis.Gmail.v1.Data.ModifyThreadRequest ModifyThreadRequestBody, string UserId, string Id, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      return mainBase.users.threads.Modify(ModifyThreadRequestBody, UserId, Id, ServiceAccount, StandardQueryParams);
                  }
  
  
  
                  /// <summary>Moves the specified thread to the trash.</summary>
                  /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                  /// user.</param>
                  /// <param name="Id">The ID of the thread to Trash.</param>
                  public Google.Apis.Gmail.v1.Data.Thread Trash (string UserId, string Id, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      return mainBase.users.threads.Trash(UserId, Id, ServiceAccount, StandardQueryParams);
                  }
  
  
  
                  /// <summary>Removes the specified thread from the trash.</summary>
                  /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                  /// user.</param>
                  /// <param name="Id">The ID of the thread to remove from Trash.</param>
                  public Google.Apis.Gmail.v1.Data.Thread Untrash (string UserId, string Id, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                  {
  
                      return mainBase.users.threads.Untrash(UserId, Id, ServiceAccount, StandardQueryParams);
                  }
  
  
              }
              #endregion
  
  
              /// <summary>Gets the current user's Gmail profile.</summary>
              /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
              /// user.</param>
              public Google.Apis.Gmail.v1.Data.Profile GetProfile (string UserId, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
              {
  
                  return mainBase.users.GetProfile(UserId, ServiceAccount, StandardQueryParams);
              }
  
  
  
              /// <summary>Stop receiving push notifications for the given user mailbox.</summary>
              /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
              /// user.</param>
              public void Stop (string UserId, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
              {
  
                  mainBase.users.Stop(UserId, ServiceAccount, StandardQueryParams);
              }
  
  
  
              /// <summary>Set up or update a push notification watch on the given user mailbox.</summary>
              /// <param name="WatchRequestBody">The body of the request.</param>
              /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
              /// user.</param>
              public Google.Apis.Gmail.v1.Data.WatchResponse Watch (Google.Apis.Gmail.v1.Data.WatchRequest WatchRequestBody, string UserId, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
              {
  
                  return mainBase.users.Watch(WatchRequestBody, UserId, ServiceAccount, StandardQueryParams);
              }
  
  
          }
          #endregion
  
          #endregion
  
      }
  }
  
  
  
  namespace gShell.dotNet
  {
      using System;
      using System.Collections.Generic;
  
      using gShell.dotNet;
      using gShell.dotNet.Utilities.OAuth2;
  
      using v1 = Google.Apis.Gmail.v1;
      using Data = Google.Apis.Gmail.v1.Data;
  
      /// <summary>The dotNet gShell version of the gmail api.</summary>
      public class Gmail : ServiceWrapper<v1.GmailService>, IServiceWrapper<Google.Apis.Services.IClientService>
      {
  
          protected override bool worksWithGmail { get { return true; } }
  
          /// <summary>Creates a new v1.Gmail service.</summary>
          /// <param name="domain">The domain to which this service will be authenticated.</param>
          /// <param name="authInfo">The authenticated AuthInfo for this user and domain.</param>
          /// <param name="gShellServiceAccount">The optional email address the service account should impersonate.</param>
  
          protected override v1.GmailService CreateNewService(string domain, AuthenticatedUserInfo authInfo, string gShellServiceAccount = null)
          {
              return new v1.GmailService(OAuth2Base.GetInitializer(domain, authInfo, gShellServiceAccount));
          }
  
          /// <summary>Returns the api name and version in {name}:{version} format.</summary>
          public override string apiNameAndVersion { get { return "gmail:v1"; } }
  
  
          /// <summary>Gets or sets the users resource class.</summary>
          public Users users{ get; set; }
  
          public Gmail()
          {
  
              users = new Users();
          }
  
  
  
          /// <summary>The "users" collection of methods.</summary>
          public class Users
          {
              /// <summary>Gets or sets the drafts resource class.</summary>
              public Drafts drafts{ get; set; }
  
              /// <summary>Gets or sets the history resource class.</summary>
              public History history{ get; set; }
  
              /// <summary>Gets or sets the labels resource class.</summary>
              public Labels labels{ get; set; }
  
              /// <summary>Gets or sets the messages resource class.</summary>
              public Messages messages{ get; set; }
  
              /// <summary>Gets or sets the settings resource class.</summary>
              public Settings settings{ get; set; }
  
              /// <summary>Gets or sets the threads resource class.</summary>
              public Threads threads{ get; set; }
  
              public Users()
              {
                  drafts = new Drafts();
                  history = new History();
                  labels = new Labels();
                  messages = new Messages();
                  settings = new Settings();
                  threads = new Threads();
              }
  
  
  
  
              /// <summary>Gets the current user's Gmail profile.</summary>
              /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
              /// user.</param>
              /// <param name="gShellServiceAccount">The optional email address the service account should impersonate.</param>
              public Google.Apis.Gmail.v1.Data.Profile GetProfile (string UserId, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
              {
                  var request = GetService(ServiceAccount).Users.GetProfile(UserId);
  
                  if (StandardQueryParams != null) {
                      request.Fields = StandardQueryParams.fields;
                      request.QuotaUser = StandardQueryParams.quotaUser;
                      request.UserIp = StandardQueryParams.userIp;
                  }
  
  
  
  
                  return request.Execute();
              }
  
              /// <summary>Stop receiving push notifications for the given user mailbox.</summary>
              /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
              /// user.</param>
              /// <param name="gShellServiceAccount">The optional email address the service account should impersonate.</param>
              public void Stop (string UserId, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
              {
                  var request = GetService(ServiceAccount).Users.Stop(UserId);
  
                  if (StandardQueryParams != null) {
                      request.Fields = StandardQueryParams.fields;
                      request.QuotaUser = StandardQueryParams.quotaUser;
                      request.UserIp = StandardQueryParams.userIp;
                  }
  
  
  
  
                  request.Execute();
              }
  
              /// <summary>Set up or update a push notification watch on the given user mailbox.</summary>
              /// <param name="WatchRequestBody">The body of the request.</param>
              /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
              /// user.</param>
              /// <param name="gShellServiceAccount">The optional email address the service account should impersonate.</param>
              public Google.Apis.Gmail.v1.Data.WatchResponse Watch (Google.Apis.Gmail.v1.Data.WatchRequest WatchRequestBody, string UserId, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
              {
                  var request = GetService(ServiceAccount).Users.Watch(WatchRequestBody, UserId);
  
                  if (StandardQueryParams != null) {
                      request.Fields = StandardQueryParams.fields;
                      request.QuotaUser = StandardQueryParams.quotaUser;
                      request.UserIp = StandardQueryParams.userIp;
                  }
  
  
  
  
                  return request.Execute();
              }
                  /// <summary>The "drafts" collection of methods.</summary>
                  public class Drafts
                  {
  
                      /// <summary>Optional parameters for the Drafts Get method.</summary>
                      public class DraftsGetProperties
                      {
                          /// <summary>The format to return the draft in.</summary>
                          public v1.UsersResource.DraftsResource.GetRequest.FormatEnum?Format = null;
                      }
  
                      /// <summary>Optional parameters for the Drafts List method.</summary>
                      public class DraftsListProperties
                      {
                          /// <summary>Include drafts from SPAM and TRASH in the results.</summary>
                          public System.Nullable<bool> IncludeSpamTrash = null;
  
                          /// <summary>Maximum number of drafts to return.</summary>
                          public int? MaxResults = null;
  
                          /// <summary>Only return draft messages matching the specified query. Supports the same query format as the Gmail search box. For example, "from:someuser@example.com rfc822msgid: is:unread".</summary>
                          public string Q = null;
  
                          /// <summary>A delegate that is used to start a progress bar.</summary>
                          public Action<string, string> StartProgressBar = null;
  
                          /// <summary>A delegate that is used to update a progress bar.</summary>
                          public Action<int, int, string, string> UpdateProgressBar = null;
  
                          /// <summary>A counter for the total number of results to pull when iterating through paged results.</summary>
                          public int TotalResults = 0;
                      }
  
  
                      /// <summary>Creates a new draft with the DRAFT label.</summary>
                      /// <param name="DraftBody">The body of the request.</param>
                      /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                      /// user.</param>
                      /// <param name="gShellServiceAccount">The optional email address the service account should impersonate.</param>
                      public Google.Apis.Gmail.v1.Data.Draft Create (Google.Apis.Gmail.v1.Data.Draft DraftBody, string UserId, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                      {
                          var request = GetService(ServiceAccount).Users.Drafts.Create(DraftBody, UserId);
  
                          if (StandardQueryParams != null) {
                              request.Fields = StandardQueryParams.fields;
                              request.QuotaUser = StandardQueryParams.quotaUser;
                              request.UserIp = StandardQueryParams.userIp;
                          }
  
  
  
  
                          return request.Execute();
                      }
  
  
                      public void Create (Google.Apis.Gmail.v1.Data.Draft DraftBody, string userId, System.IO.Stream stream, string contentType, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                      {
                          var request = GetService(ServiceAccount).Users.Drafts.Create(DraftBody, userId, stream, contentType);
  
  
  
                          request.Upload();
                      }
  
                      /// <summary>Immediately and permanently deletes the specified draft. Does not simply trash
                      /// it.</summary>
                      /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                      /// user.</param>
                      /// <param name="Id">The ID of the draft to delete.</param>
                      /// <param name="gShellServiceAccount">The optional email address the service account should impersonate.</param>
                      public void Delete (string UserId, string Id, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                      {
                          var request = GetService(ServiceAccount).Users.Drafts.Delete(UserId, Id);
  
                          if (StandardQueryParams != null) {
                              request.Fields = StandardQueryParams.fields;
                              request.QuotaUser = StandardQueryParams.quotaUser;
                              request.UserIp = StandardQueryParams.userIp;
                          }
  
  
  
  
                          request.Execute();
                      }
  
                      /// <summary>Gets the specified draft.</summary>
                      /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                      /// user.</param>
                      /// <param name="Id">The ID of the draft to retrieve.</param>
                      /// <param name="properties">The optional properties for this method.</param>
                      /// <param name="gShellServiceAccount">The optional email address the service account should impersonate.</param>
                      public Google.Apis.Gmail.v1.Data.Draft Get (string UserId, string Id, DraftsGetProperties properties= null, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                      {
                          var request = GetService(ServiceAccount).Users.Drafts.Get(UserId, Id);
  
                          if (StandardQueryParams != null) {
                              request.Fields = StandardQueryParams.fields;
                              request.QuotaUser = StandardQueryParams.quotaUser;
                              request.UserIp = StandardQueryParams.userIp;
                          }
  
  
                          if (properties != null)    {
                              request.Format = properties.Format;
                          }
  
                          return request.Execute();
                      }
  
                      /// <summary>Lists the drafts in the user's mailbox.</summary>
                      /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                      /// user.</param>
                      /// <param name="properties">The optional properties for this method.</param>
                      /// <param name="gShellServiceAccount">The optional email address the service account should impersonate.</param>
                      public List<Google.Apis.Gmail.v1.Data.ListDraftsResponse> List(
                          string UserId, DraftsListProperties properties= null, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                      {
                          var results = new List<Google.Apis.Gmail.v1.Data.ListDraftsResponse>();
  
                          v1.UsersResource.DraftsResource.ListRequest request = GetService(ServiceAccount).Users.Drafts.List(UserId);
  
                          if (StandardQueryParams != null) {
                              request.Fields = StandardQueryParams.fields;
                              request.QuotaUser = StandardQueryParams.quotaUser;
                              request.UserIp = StandardQueryParams.userIp;
                          }
  
                          if (properties != null)
                          {
                              request.IncludeSpamTrash = properties.IncludeSpamTrash;
                              request.MaxResults = properties.MaxResults;
                              request.Q = properties.Q;
  
                          }
  
                          if (null != properties.StartProgressBar)
                          {
                              properties.StartProgressBar("Gathering Drafts",
                                  string.Format("-Collecting Drafts page 1"));
                          }
  
                          Google.Apis.Gmail.v1.Data.ListDraftsResponse pagedResult = request.Execute();
  
                          if (pagedResult != null)
                          {
                              results.Add(pagedResult);
  
                              while (!string.IsNullOrWhiteSpace(pagedResult.NextPageToken) &&
                                  pagedResult.NextPageToken != request.PageToken &&
                              (properties.TotalResults == 0 || results.Count < properties.TotalResults))
                              {
                                  request.PageToken = pagedResult.NextPageToken;
  
                                  if (null != properties.UpdateProgressBar)
                                  {
                                      properties.UpdateProgressBar(5, 10, "Gathering Drafts",
                                              string.Format("-Collecting Drafts page {0}",
                                                  (results.Count + 1).ToString()));
                                  }
                                  pagedResult = request.Execute();
                                  results.Add(pagedResult);
                              }
  
                              if (null != properties.UpdateProgressBar)
                              {
                                  properties.UpdateProgressBar(1, 2, "Gathering Drafts",
                                          string.Format("-Returning {0} pages.", results.Count.ToString()));
                              }
                          }
  
                          return results;
                      }
  
                      /// <summary>Sends the specified, existing draft to the recipients in the To, Cc, and Bcc
                      /// headers.</summary>
                      /// <param name="DraftBody">The body of the request.</param>
                      /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                      /// user.</param>
                      /// <param name="gShellServiceAccount">The optional email address the service account should impersonate.</param>
                      public Google.Apis.Gmail.v1.Data.Message Send (Google.Apis.Gmail.v1.Data.Draft DraftBody, string UserId, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                      {
                          var request = GetService(ServiceAccount).Users.Drafts.Send(DraftBody, UserId);
  
                          if (StandardQueryParams != null) {
                              request.Fields = StandardQueryParams.fields;
                              request.QuotaUser = StandardQueryParams.quotaUser;
                              request.UserIp = StandardQueryParams.userIp;
                          }
  
  
  
  
                          return request.Execute();
                      }
  
  
                      public void Send (Google.Apis.Gmail.v1.Data.Draft DraftBody, string userId, System.IO.Stream stream, string contentType, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                      {
                          var request = GetService(ServiceAccount).Users.Drafts.Send(DraftBody, userId, stream, contentType);
  
  
  
                          request.Upload();
                      }
  
                      /// <summary>Replaces a draft's content.</summary>
                      /// <param name="DraftBody">The body of the request.</param>
                      /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                      /// user.</param>
                      /// <param name="Id">The ID of the draft to update.</param>
                      /// <param name="gShellServiceAccount">The optional email address the service account should impersonate.</param>
                      public Google.Apis.Gmail.v1.Data.Draft Update (Google.Apis.Gmail.v1.Data.Draft DraftBody, string UserId, string Id, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                      {
                          var request = GetService(ServiceAccount).Users.Drafts.Update(DraftBody, UserId, Id);
  
                          if (StandardQueryParams != null) {
                              request.Fields = StandardQueryParams.fields;
                              request.QuotaUser = StandardQueryParams.quotaUser;
                              request.UserIp = StandardQueryParams.userIp;
                          }
  
  
  
  
                          return request.Execute();
                      }
  
  
                      public void Update (Google.Apis.Gmail.v1.Data.Draft DraftBody, string userId, string id, System.IO.Stream stream, string contentType, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                      {
                          var request = GetService(ServiceAccount).Users.Drafts.Update(DraftBody, userId, id, stream, contentType);
  
  
  
                          request.Upload();
                      }
  
                  }    /// <summary>The "history" collection of methods.</summary>
                  public class History
                  {
  
                      /// <summary>Optional parameters for the History List method.</summary>
                      public class HistoryListProperties
                      {
                          /// <summary>Only return messages with a label matching the ID.</summary>
                          public string LabelId = null;
  
                          /// <summary>The maximum number of history records to return.</summary>
                          public int? MaxResults = null;
  
                          /// <summary>Required. Returns history records after the specified startHistoryId. The supplied startHistoryId should be obtained from the historyId of a message, thread, or previous list response. History IDs increase chronologically but are not contiguous with random gaps in between valid IDs. Supplying an invalid or out of date startHistoryId typically returns an HTTP 404 error code. A historyId is typically valid for at least a week, but in some rare circumstances may be valid for only a few hours. If you receive an HTTP 404 error response, your application should perform a full sync. If you receive no nextPageToken in the response, there are no updates to retrieve and you can store the returned historyId for a future request.</summary>
                          public System.Nullable<ulong> StartHistoryId = null;
  
                          /// <summary>A delegate that is used to start a progress bar.</summary>
                          public Action<string, string> StartProgressBar = null;
  
                          /// <summary>A delegate that is used to update a progress bar.</summary>
                          public Action<int, int, string, string> UpdateProgressBar = null;
  
                          /// <summary>A counter for the total number of results to pull when iterating through paged results.</summary>
                          public int TotalResults = 0;
                      }
  
  
                      /// <summary>Lists the history of all changes to the given mailbox. History results are returned in
                      /// chronological order (increasing historyId).</summary>
                      /// <param name="UserId">The user's email address. The special value me can be used to indicate the authenticated
                      /// user.</param>
                      /// <param name="properties">The optional properties for this method.</param>
                      /// <param name="gShellServiceAccount">The optional email address the service account should impersonate.</param>
                      public List<Google.Apis.Gmail.v1.Data.ListHistoryResponse> List(
                          string UserId, HistoryListProperties properties= null, string ServiceAccount = null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
                      {
                          var results = new List<Google.Apis.Gmail.v1.Data.ListHistoryResponse>();
  
                          v1.UsersResource.HistoryResource.ListRequest request = GetService(ServiceAccount).Users.History.List(UserId);
  
  
gt:                         if (StandardQueryParams != null) {