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.DataTransfer{
  
      using System;
      using System.Collections.Generic;
      using System.Management.Automation;
  
      using Google.Apis.Auth.OAuth2;
      using Google.Apis.Services;
      using datatransfer_v1 = Google.Apis.admin.DataTransfer.datatransfer_v1;
      using Data = Google.Apis.admin.DataTransfer.datatransfer_v1.Data;
  
      using gShell.dotNet.Utilities;
      using gShell.dotNet.Utilities.OAuth2;
      using gDataTransfer = gShell.dotNet.DataTransfer;
  
      /// <summary>
      /// A PowerShell-ready wrapper for the DataTransfer api, as well as the resources and methods therein.
      /// </summary>
      public abstract class DataTransferBase : StandardParamsCmdletBase
      {
  
          #region Properties
  
          /// <summary>The gShell dotNet class wrapper base.</summary>
          protected static gDataTransfer mainBase { get; set; }
  
  
          /// <summary>An instance of the Applications gShell dotNet resource.</summary>
          public Applications applications { get; set; }
  
          /// <summary>An instance of the Transfers gShell dotNet resource.</summary>
          public Transfers transfers { get; set; }
  
          /// <summary>
          /// Required to be able to store and retrieve the mainBase from the ServiceWrapperDictionary
          /// </summary>
          protected override Type mainBaseType { get { return typeof(gDataTransfer); } }
          #endregion
  
          #region Constructors
          protected DataTransferBase()
          {
              mainBase = new gDataTransfer();
  
              ServiceWrapperDictionary[mainBaseType] = mainBase;
  
  
              applications = new Applications();
              transfers = new Transfers();
          }
          #endregion
  
          #region Wrapped Methods
  
  
  
          #region Applications
  
          /// <summary>A wrapper class for the Applications resource.</summary>
          public class Applications
          {
  
  
  
  
              /// <summary>Retrieves information about an application for the given application ID.</summary>
              /// <param name="ApplicationId">ID of the application resource to be retrieved.</param>
              public Google.Apis.admin.DataTransfer.datatransfer_v1.Data.Application Get (long ApplicationId, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
              {
  
                  return mainBase.applications.Get(ApplicationId, StandardQueryParams);
              }
  
  
  
              /// <summary>Lists the applications available for data transfer for a customer.</summary>
              /// <param name="properties">The optional properties for this method.</param>
  
              public List<Google.Apis.admin.DataTransfer.datatransfer_v1.Data.ApplicationsListResponse> List(gDataTransfer.Applications.ApplicationsListProperties properties= null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
              {
  
                  properties = properties ?? new gDataTransfer.Applications.ApplicationsListProperties();
                  properties.StartProgressBar = StartProgressBar;
                  properties.UpdateProgressBar = UpdateProgressBar;
  
                  return mainBase.applications.List(properties);
              }
          }
          #endregion
  
  
  
          #region Transfers
  
          /// <summary>A wrapper class for the Transfers resource.</summary>
          public class Transfers
          {
  
  
  
  
              /// <summary>Retrieves a data transfer request by its resource ID.</summary>
              /// <param name="DataTransferId">ID of the resource to be retrieved. This is returned in the response from the insert
              /// method.</param>
              public Google.Apis.admin.DataTransfer.datatransfer_v1.Data.DataTransfer Get (string DataTransferId, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
              {
  
                  return mainBase.transfers.Get(DataTransferId, StandardQueryParams);
              }
  
  
  
              /// <summary>Inserts a data transfer request.</summary>
              /// <param name="DataTransferBody">The body of the request.</param>
              public Google.Apis.admin.DataTransfer.datatransfer_v1.Data.DataTransfer Insert (Google.Apis.admin.DataTransfer.datatransfer_v1.Data.DataTransfer DataTransferBody, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
              {
  
                  return mainBase.transfers.Insert(DataTransferBody, StandardQueryParams);
              }
  
  
  
              /// <summary>Lists the transfers for a customer by source user, destination user, or status.</summary>
              /// <param name="properties">The optional properties for this method.</param>
  
              public List<Google.Apis.admin.DataTransfer.datatransfer_v1.Data.DataTransfersListResponse> List(gDataTransfer.Transfers.TransfersListProperties properties= null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
              {
  
                  properties = properties ?? new gDataTransfer.Transfers.TransfersListProperties();
                  properties.StartProgressBar = StartProgressBar;
                  properties.UpdateProgressBar = UpdateProgressBar;
  
                  return mainBase.transfers.List(properties);
              }
          }
          #endregion
  
          #endregion
  
      }
  }
  
  
  
  namespace gShell.dotNet
  {
      using System;
      using System.Collections.Generic;
  
      using gShell.dotNet;
      using gShell.dotNet.Utilities.OAuth2;
  
      using datatransfer_v1 = Google.Apis.admin.DataTransfer.datatransfer_v1;
      using Data = Google.Apis.admin.DataTransfer.datatransfer_v1.Data;
  
      /// <summary>The dotNet gShell version of the admin api.</summary>
      public class DataTransfer : ServiceWrapper<datatransfer_v1.DataTransferService>, IServiceWrapper<Google.Apis.Services.IClientService>
      {
  
          protected override bool worksWithGmail { get { return false; } }
  
          /// <summary>Creates a new datatransfer_v1.DataTransfer 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 datatransfer_v1.DataTransferService CreateNewService(string domain, AuthenticatedUserInfo authInfo, string gShellServiceAccount = null)
          {
              return new datatransfer_v1.DataTransferService(OAuth2Base.GetInitializer(domain, authInfo));
          }
  
          /// <summary>Returns the api name and version in {name}:{version} format.</summary>
          public override string apiNameAndVersion { get { return "admin:datatransfer_v1"; } }
  
  
          /// <summary>Gets or sets the applications resource class.</summary>
          public Applications applications{ get; set; }
  
          /// <summary>Gets or sets the transfers resource class.</summary>
          public Transfers transfers{ get; set; }
  
          public DataTransfer()
          {
  
              applications = new Applications();
              transfers = new Transfers();
          }
  
  
  
          /// <summary>The "applications" collection of methods.</summary>
          public class Applications
          {
  
              /// <summary>Optional parameters for the Applications List method.</summary>
              public class ApplicationsListProperties
              {
                  /// <summary>Immutable ID of the Google Apps account.</summary>
                  public string CustomerId = null;
  
                  /// <summary>Maximum number of results to return. Default is 100.</summary>
                  public int? MaxResults = 500;
  
                  /// <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>Retrieves information about an application for the given application ID.</summary>
              /// <param name="ApplicationId">ID of the application resource to be retrieved.</param>
              /// <param name="gShellServiceAccount">The optional email address the service account should impersonate.</param>
              public Google.Apis.admin.DataTransfer.datatransfer_v1.Data.Application Get (long ApplicationId, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
              {
                  var request = GetService().Applications.Get(ApplicationId);
  
                  if (StandardQueryParams != null) {
                      request.Fields = StandardQueryParams.fields;
                      request.QuotaUser = StandardQueryParams.quotaUser;
                      request.UserIp = StandardQueryParams.userIp;
                  }
  
  
  
                  return request.Execute();
              }
  
              /// <summary>Lists the applications available for data transfer for a customer.</summary>
              /// <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.admin.DataTransfer.datatransfer_v1.Data.ApplicationsListResponse> List(
                  ApplicationsListProperties properties= null, gShell.dotNet.Utilities.OAuth2.StandardQueryParameters StandardQueryParams = null)
              {
                  var results = new List<Google.Apis.admin.DataTransfer.datatransfer_v1.Data.ApplicationsListResponse>();
  
                  datatransfer_v1.ApplicationsResource.ListRequest request = GetService().Applications.List();
  
                  if (StandardQueryParams != null) {
                      request.Fields = StandardQueryParams.fields;
                      request.QuotaUser = StandardQueryParams.quotaUser;
                      request.UserIp = StandardQueryParams.userIp;
                  }
  
                  if (properties != null)
                  {
                      request.CustomerId = properties.CustomerId;
                      request.MaxResults = properties.MaxResults;
  
                  }
  
                  if (null != properties.StartProgressBar)
                  {
                      properties.StartProgressBar("Gathering Applications",
                          string.Format("-Collecting Applications page 1"));
                  }
  
                  Google.Apis.admin.DataTransfer.datatransfer_v1.Data.ApplicationsListResponse 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;
  
  
gt:                         if (null != properties.UpdateProgressBar)