/*
 * SnapTrade
 *
 * Connect brokerage accounts to your app for live positions and trading
 *
 * The version of the OpenAPI document: 1.0.0
 * Contact: anpch@example.com
 * Generated by: https://konfigthis.com
 */


using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Net;
using System.Net.Mime;
using SnapTrade.Net.Client;
using SnapTrade.Net.Model;

namespace SnapTrade.Net.Api
{

    /// <summary>
    /// Represents a collection of functions to interact with the API endpoints
    /// </summary>
    public interface IAuthenticationApiSync : IApiAccessor
    {
        #region Synchronous Operations
        /// <summary>
        /// Delete user from SnapTrade, disabling all brokerage authorizations and permanently deleting all data associated with the user
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="userId"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>DeleteUserResponse</returns>
        DeleteUserResponse DeleteSnapTradeUser(string userId, int operationIndex = 0);

        /// <summary>
        /// Delete user from SnapTrade, disabling all brokerage authorizations and permanently deleting all data associated with the user
        /// </summary>
        /// <remarks>
        /// 
        /// </remarks>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="userId"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>ApiResponse of DeleteUserResponse</returns>
        ApiResponse<DeleteUserResponse> DeleteSnapTradeUserWithHttpInfo(string userId, int operationIndex = 0);
        /// <summary>
        /// Obtains an encrypted JWT tokens that should be decrypted on a user&#39;s local device
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="userId"></param>
        /// <param name="userSecret"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>EncryptedResponse</returns>
        EncryptedResponse GetUserJWT(string userId, string userSecret, int operationIndex = 0);

        /// <summary>
        /// Obtains an encrypted JWT tokens that should be decrypted on a user&#39;s local device
        /// </summary>
        /// <remarks>
        /// 
        /// </remarks>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="userId"></param>
        /// <param name="userSecret"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>ApiResponse of EncryptedResponse</returns>
        ApiResponse<EncryptedResponse> GetUserJWTWithHttpInfo(string userId, string userSecret, int operationIndex = 0);
        /// <summary>
        /// Get a list of all SnapTrade users you&#39;ve registered on our platform
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>List&lt;string&gt;</returns>
        List<string> ListSnapTradeUsers(int operationIndex = 0);

        /// <summary>
        /// Get a list of all SnapTrade users you&#39;ve registered on our platform
        /// </summary>
        /// <remarks>
        /// 
        /// </remarks>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>ApiResponse of List&lt;string&gt;</returns>
        ApiResponse<List<string>> ListSnapTradeUsersWithHttpInfo(int operationIndex = 0);
        /// <summary>
        /// Generate a redirect URI to securely login a user to the SnapTrade Connection Portal
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="userId"></param>
        /// <param name="userSecret"></param>
        /// <param name="snapTradeLoginUserRequestBody"> (optional)</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>AuthenticationLoginSnapTradeUser200Response</returns>
        AuthenticationLoginSnapTradeUser200Response LoginSnapTradeUser(string userId, string userSecret, SnapTradeLoginUserRequestBody snapTradeLoginUserRequestBody = default(SnapTradeLoginUserRequestBody), int operationIndex = 0);

        /// <summary>
        /// Generate a redirect URI to securely login a user to the SnapTrade Connection Portal
        /// </summary>
        /// <remarks>
        /// 
        /// </remarks>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="userId"></param>
        /// <param name="userSecret"></param>
        /// <param name="snapTradeLoginUserRequestBody"> (optional)</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>ApiResponse of AuthenticationLoginSnapTradeUser200Response</returns>
        ApiResponse<AuthenticationLoginSnapTradeUser200Response> LoginSnapTradeUserWithHttpInfo(string userId, string userSecret, SnapTradeLoginUserRequestBody snapTradeLoginUserRequestBody = default(SnapTradeLoginUserRequestBody), int operationIndex = 0);
        /// <summary>
        /// Register user with SnapTrade in order to create secure brokerage authorizations
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="snapTradeRegisterUserRequestBody"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>UserIDandSecret</returns>
        UserIDandSecret RegisterSnapTradeUser(SnapTradeRegisterUserRequestBody snapTradeRegisterUserRequestBody, int operationIndex = 0);

        /// <summary>
        /// Register user with SnapTrade in order to create secure brokerage authorizations
        /// </summary>
        /// <remarks>
        /// 
        /// </remarks>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="snapTradeRegisterUserRequestBody"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>ApiResponse of UserIDandSecret</returns>
        ApiResponse<UserIDandSecret> RegisterSnapTradeUserWithHttpInfo(SnapTradeRegisterUserRequestBody snapTradeRegisterUserRequestBody, int operationIndex = 0);
        #endregion Synchronous Operations
    }

    /// <summary>
    /// Represents a collection of functions to interact with the API endpoints
    /// </summary>
    public interface IAuthenticationApiAsync : IApiAccessor
    {
        #region Asynchronous Operations
        /// <summary>
        /// Delete user from SnapTrade, disabling all brokerage authorizations and permanently deleting all data associated with the user
        /// </summary>
        /// <remarks>
        /// 
        /// </remarks>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="userId"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of DeleteUserResponse</returns>
        System.Threading.Tasks.Task<DeleteUserResponse> DeleteSnapTradeUserAsync(string userId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));

        /// <summary>
        /// Delete user from SnapTrade, disabling all brokerage authorizations and permanently deleting all data associated with the user
        /// </summary>
        /// <remarks>
        /// 
        /// </remarks>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="userId"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of ApiResponse (DeleteUserResponse)</returns>
        System.Threading.Tasks.Task<ApiResponse<DeleteUserResponse>> DeleteSnapTradeUserWithHttpInfoAsync(string userId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
        /// <summary>
        /// Obtains an encrypted JWT tokens that should be decrypted on a user&#39;s local device
        /// </summary>
        /// <remarks>
        /// 
        /// </remarks>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="userId"></param>
        /// <param name="userSecret"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of EncryptedResponse</returns>
        System.Threading.Tasks.Task<EncryptedResponse> GetUserJWTAsync(string userId, string userSecret, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));

        /// <summary>
        /// Obtains an encrypted JWT tokens that should be decrypted on a user&#39;s local device
        /// </summary>
        /// <remarks>
        /// 
        /// </remarks>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="userId"></param>
        /// <param name="userSecret"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of ApiResponse (EncryptedResponse)</returns>
        System.Threading.Tasks.Task<ApiResponse<EncryptedResponse>> GetUserJWTWithHttpInfoAsync(string userId, string userSecret, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
        /// <summary>
        /// Get a list of all SnapTrade users you&#39;ve registered on our platform
        /// </summary>
        /// <remarks>
        /// 
        /// </remarks>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of List&lt;string&gt;</returns>
        System.Threading.Tasks.Task<List<string>> ListSnapTradeUsersAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));

        /// <summary>
        /// Get a list of all SnapTrade users you&#39;ve registered on our platform
        /// </summary>
        /// <remarks>
        /// 
        /// </remarks>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of ApiResponse (List&lt;string&gt;)</returns>
        System.Threading.Tasks.Task<ApiResponse<List<string>>> ListSnapTradeUsersWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
        /// <summary>
        /// Generate a redirect URI to securely login a user to the SnapTrade Connection Portal
        /// </summary>
        /// <remarks>
        /// 
        /// </remarks>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="userId"></param>
        /// <param name="userSecret"></param>
        /// <param name="snapTradeLoginUserRequestBody"> (optional)</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of AuthenticationLoginSnapTradeUser200Response</returns>
        System.Threading.Tasks.Task<AuthenticationLoginSnapTradeUser200Response> LoginSnapTradeUserAsync(string userId, string userSecret, SnapTradeLoginUserRequestBody snapTradeLoginUserRequestBody = default(SnapTradeLoginUserRequestBody), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));

        /// <summary>
        /// Generate a redirect URI to securely login a user to the SnapTrade Connection Portal
        /// </summary>
        /// <remarks>
        /// 
        /// </remarks>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="userId"></param>
        /// <param name="userSecret"></param>
        /// <param name="snapTradeLoginUserRequestBody"> (optional)</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of ApiResponse (AuthenticationLoginSnapTradeUser200Response)</returns>
        System.Threading.Tasks.Task<ApiResponse<AuthenticationLoginSnapTradeUser200Response>> LoginSnapTradeUserWithHttpInfoAsync(string userId, string userSecret, SnapTradeLoginUserRequestBody snapTradeLoginUserRequestBody = default(SnapTradeLoginUserRequestBody), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
        /// <summary>
        /// Register user with SnapTrade in order to create secure brokerage authorizations
        /// </summary>
        /// <remarks>
        /// 
        /// </remarks>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="snapTradeRegisterUserRequestBody"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of UserIDandSecret</returns>
        System.Threading.Tasks.Task<UserIDandSecret> RegisterSnapTradeUserAsync(SnapTradeRegisterUserRequestBody snapTradeRegisterUserRequestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));

        /// <summary>
        /// Register user with SnapTrade in order to create secure brokerage authorizations
        /// </summary>
        /// <remarks>
        /// 
        /// </remarks>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="snapTradeRegisterUserRequestBody"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of ApiResponse (UserIDandSecret)</returns>
        System.Threading.Tasks.Task<ApiResponse<UserIDandSecret>> RegisterSnapTradeUserWithHttpInfoAsync(SnapTradeRegisterUserRequestBody snapTradeRegisterUserRequestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
        #endregion Asynchronous Operations
    }

    /// <summary>
    /// Represents a collection of functions to interact with the API endpoints
    /// </summary>
    public interface IAuthenticationApi : IAuthenticationApiSync, IAuthenticationApiAsync
    {

    }

    /// <summary>
    /// Represents a collection of functions to interact with the API endpoints
    /// </summary>
    public partial class AuthenticationApi : IAuthenticationApi
    {
        private SnapTrade.Net.Client.ExceptionFactory _exceptionFactory = (name, response) => null;

        /// <summary>
        /// Initializes a new instance of the <see cref="AuthenticationApi"/> class.
        /// </summary>
        /// <returns></returns>
        public AuthenticationApi() : this((string)null)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="AuthenticationApi"/> class.
        /// </summary>
        /// <returns></returns>
        public AuthenticationApi(string basePath)
        {
            this.Configuration = SnapTrade.Net.Client.Configuration.MergeConfigurations(
                SnapTrade.Net.Client.GlobalConfiguration.Instance,
                new SnapTrade.Net.Client.Configuration { BasePath = basePath }
            );
            this.Client = new SnapTrade.Net.Client.ApiClient(this.Configuration);
            this.AsynchronousClient = new SnapTrade.Net.Client.ApiClient(this.Configuration);
            this.ExceptionFactory = SnapTrade.Net.Client.Configuration.DefaultExceptionFactory;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="AuthenticationApi"/> class
        /// using Configuration object
        /// </summary>
        /// <param name="configuration">An instance of Configuration</param>
        /// <returns></returns>
        public AuthenticationApi(SnapTrade.Net.Client.Configuration configuration)
        {
            if (configuration == null) throw new ArgumentNullException("configuration");

            this.Configuration = SnapTrade.Net.Client.Configuration.MergeConfigurations(
                SnapTrade.Net.Client.GlobalConfiguration.Instance,
                configuration
            );
            this.Client = new SnapTrade.Net.Client.ApiClient(this.Configuration);
            this.AsynchronousClient = new SnapTrade.Net.Client.ApiClient(this.Configuration);
            this.ExceptionFactory = SnapTrade.Net.Client.Configuration.DefaultExceptionFactory;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="AuthenticationApi"/> class
        /// using a Configuration object and client instance.
        /// </summary>
        /// <param name="client">The client interface for synchronous API access.</param>
        /// <param name="asyncClient">The client interface for asynchronous API access.</param>
        /// <param name="configuration">The configuration object.</param>
        public AuthenticationApi(SnapTrade.Net.Client.ISynchronousClient client, SnapTrade.Net.Client.IAsynchronousClient asyncClient, SnapTrade.Net.Client.IReadableConfiguration configuration)
        {
            if (client == null) throw new ArgumentNullException("client");
            if (asyncClient == null) throw new ArgumentNullException("asyncClient");
            if (configuration == null) throw new ArgumentNullException("configuration");

            this.Client = client;
            this.AsynchronousClient = asyncClient;
            this.Configuration = configuration;
            this.ExceptionFactory = SnapTrade.Net.Client.Configuration.DefaultExceptionFactory;
        }

        /// <summary>
        /// The client for accessing this underlying API asynchronously.
        /// </summary>
        public SnapTrade.Net.Client.IAsynchronousClient AsynchronousClient { get; set; }

        /// <summary>
        /// The client for accessing this underlying API synchronously.
        /// </summary>
        public SnapTrade.Net.Client.ISynchronousClient Client { get; set; }

        /// <summary>
        /// Gets the base path of the API client.
        /// </summary>
        /// <value>The base path</value>
        public string GetBasePath()
        {
            return this.Configuration.BasePath;
        }

        /// <summary>
        /// Gets or sets the configuration object
        /// </summary>
        /// <value>An instance of the Configuration</value>
        public SnapTrade.Net.Client.IReadableConfiguration Configuration { get; set; }

        /// <summary>
        /// Provides a factory method hook for the creation of exceptions.
        /// </summary>
        public SnapTrade.Net.Client.ExceptionFactory ExceptionFactory
        {
            get
            {
                if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1)
                {
                    throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported.");
                }
                return _exceptionFactory;
            }
            set { _exceptionFactory = value; }
        }

        /// <summary>
        /// Delete user from SnapTrade, disabling all brokerage authorizations and permanently deleting all data associated with the user 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="userId"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>DeleteUserResponse</returns>
        public DeleteUserResponse DeleteSnapTradeUser(string userId, int operationIndex = 0)
        {
            SnapTrade.Net.Client.ApiResponse<DeleteUserResponse> localVarResponse = DeleteSnapTradeUserWithHttpInfo(userId);
            return localVarResponse.Data;
        }

        /// <summary>
        /// Delete user from SnapTrade, disabling all brokerage authorizations and permanently deleting all data associated with the user 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="userId"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>ApiResponse of DeleteUserResponse</returns>
        public SnapTrade.Net.Client.ApiResponse<DeleteUserResponse> DeleteSnapTradeUserWithHttpInfo(string userId, int operationIndex = 0)
        {
            // verify the required parameter 'userId' is set
            if (userId == null)
            {
                throw new SnapTrade.Net.Client.ApiException(400, "Missing required parameter 'userId' when calling AuthenticationApi->DeleteSnapTradeUser");
            }

            SnapTrade.Net.Client.RequestOptions localVarRequestOptions = new SnapTrade.Net.Client.RequestOptions();

            string[] _contentTypes = new string[] {
            };

            // to determine the Accept header
            string[] _accepts = new string[] {
                "application/json"
            };

            var localVarContentType = SnapTrade.Net.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = SnapTrade.Net.Client.ClientUtils.SelectHeaderAccept(_accepts);
            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "userId", userId, ""));

            localVarRequestOptions.Operation = "AuthenticationApi.DeleteSnapTradeUser";
            localVarRequestOptions.OperationIndex = operationIndex;

            // authentication (PartnerClientId) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("clientId")))
            {
                localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "clientId", this.Configuration.GetApiKeyWithPrefix("clientId")));
            }
            // authentication (PartnerSignature) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Signature")))
            {
                localVarRequestOptions.HeaderParameters.Add("Signature", this.Configuration.GetApiKeyWithPrefix("Signature"));
            }
            // authentication (PartnerTimestamp) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("timestamp")))
            {
                localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "timestamp", this.Configuration.GetApiKeyWithPrefix("timestamp")));
            }

            // make the HTTP request
            var localVarResponse = this.Client.Delete<DeleteUserResponse>("/snapTrade/deleteUser", localVarRequestOptions, this.Configuration);
            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("DeleteSnapTradeUser", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return localVarResponse;
        }

        /// <summary>
        /// Delete user from SnapTrade, disabling all brokerage authorizations and permanently deleting all data associated with the user 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="userId"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of DeleteUserResponse</returns>
        public async System.Threading.Tasks.Task<DeleteUserResponse> DeleteSnapTradeUserAsync(string userId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            SnapTrade.Net.Client.ApiResponse<DeleteUserResponse> localVarResponse = await DeleteSnapTradeUserWithHttpInfoAsync(userId, operationIndex, cancellationToken).ConfigureAwait(false);
            return localVarResponse.Data;
        }

        /// <summary>
        /// Delete user from SnapTrade, disabling all brokerage authorizations and permanently deleting all data associated with the user 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="userId"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of ApiResponse (DeleteUserResponse)</returns>
        public async System.Threading.Tasks.Task<SnapTrade.Net.Client.ApiResponse<DeleteUserResponse>> DeleteSnapTradeUserWithHttpInfoAsync(string userId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            // verify the required parameter 'userId' is set
            if (userId == null)
            {
                throw new SnapTrade.Net.Client.ApiException(400, "Missing required parameter 'userId' when calling AuthenticationApi->DeleteSnapTradeUser");
            }


            SnapTrade.Net.Client.RequestOptions localVarRequestOptions = new SnapTrade.Net.Client.RequestOptions();

            string[] _contentTypes = new string[] {
            };

            // to determine the Accept header
            string[] _accepts = new string[] {
                "application/json"
            };

            var localVarContentType = SnapTrade.Net.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = SnapTrade.Net.Client.ClientUtils.SelectHeaderAccept(_accepts);
            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "userId", userId, ""));

            localVarRequestOptions.Operation = "AuthenticationApi.DeleteSnapTradeUser";
            localVarRequestOptions.OperationIndex = operationIndex;

            // authentication (PartnerClientId) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("clientId")))
            {
                localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "clientId", this.Configuration.GetApiKeyWithPrefix("clientId")));
            }
            // authentication (PartnerSignature) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Signature")))
            {
                localVarRequestOptions.HeaderParameters.Add("Signature", this.Configuration.GetApiKeyWithPrefix("Signature"));
            }
            // authentication (PartnerTimestamp) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("timestamp")))
            {
                localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "timestamp", this.Configuration.GetApiKeyWithPrefix("timestamp")));
            }

            // make the HTTP request
            var localVarResponse = await this.AsynchronousClient.DeleteAsync<DeleteUserResponse>("/snapTrade/deleteUser", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("DeleteSnapTradeUser", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return localVarResponse;
        }

        /// <summary>
        /// Obtains an encrypted JWT tokens that should be decrypted on a user&#39;s local device 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="userId"></param>
        /// <param name="userSecret"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>EncryptedResponse</returns>
        public EncryptedResponse GetUserJWT(string userId, string userSecret, int operationIndex = 0)
        {
            SnapTrade.Net.Client.ApiResponse<EncryptedResponse> localVarResponse = GetUserJWTWithHttpInfo(userId, userSecret);
            return localVarResponse.Data;
        }

        /// <summary>
        /// Obtains an encrypted JWT tokens that should be decrypted on a user&#39;s local device 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="userId"></param>
        /// <param name="userSecret"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>ApiResponse of EncryptedResponse</returns>
        public SnapTrade.Net.Client.ApiResponse<EncryptedResponse> GetUserJWTWithHttpInfo(string userId, string userSecret, int operationIndex = 0)
        {
            // verify the required parameter 'userId' is set
            if (userId == null)
            {
                throw new SnapTrade.Net.Client.ApiException(400, "Missing required parameter 'userId' when calling AuthenticationApi->GetUserJWT");
            }

            // verify the required parameter 'userSecret' is set
            if (userSecret == null)
            {
                throw new SnapTrade.Net.Client.ApiException(400, "Missing required parameter 'userSecret' when calling AuthenticationApi->GetUserJWT");
            }

            SnapTrade.Net.Client.RequestOptions localVarRequestOptions = new SnapTrade.Net.Client.RequestOptions();

            string[] _contentTypes = new string[] {
            };

            // to determine the Accept header
            string[] _accepts = new string[] {
                "application/json"
            };

            var localVarContentType = SnapTrade.Net.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = SnapTrade.Net.Client.ClientUtils.SelectHeaderAccept(_accepts);
            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "userId", userId, ""));
            localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "userSecret", userSecret, ""));

            localVarRequestOptions.Operation = "AuthenticationApi.GetUserJWT";
            localVarRequestOptions.OperationIndex = operationIndex;

            // authentication (PartnerClientId) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("clientId")))
            {
                localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "clientId", this.Configuration.GetApiKeyWithPrefix("clientId")));
            }
            // authentication (PartnerSignature) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Signature")))
            {
                localVarRequestOptions.HeaderParameters.Add("Signature", this.Configuration.GetApiKeyWithPrefix("Signature"));
            }
            // authentication (PartnerTimestamp) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("timestamp")))
            {
                localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "timestamp", this.Configuration.GetApiKeyWithPrefix("timestamp")));
            }

            // make the HTTP request
            var localVarResponse = this.Client.Get<EncryptedResponse>("/snapTrade/encryptedJWT", localVarRequestOptions, this.Configuration);
            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("GetUserJWT", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return localVarResponse;
        }

        /// <summary>
        /// Obtains an encrypted JWT tokens that should be decrypted on a user&#39;s local device 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="userId"></param>
        /// <param name="userSecret"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of EncryptedResponse</returns>
        public async System.Threading.Tasks.Task<EncryptedResponse> GetUserJWTAsync(string userId, string userSecret, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            SnapTrade.Net.Client.ApiResponse<EncryptedResponse> localVarResponse = await GetUserJWTWithHttpInfoAsync(userId, userSecret, operationIndex, cancellationToken).ConfigureAwait(false);
            return localVarResponse.Data;
        }

        /// <summary>
        /// Obtains an encrypted JWT tokens that should be decrypted on a user&#39;s local device 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="userId"></param>
        /// <param name="userSecret"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of ApiResponse (EncryptedResponse)</returns>
        public async System.Threading.Tasks.Task<SnapTrade.Net.Client.ApiResponse<EncryptedResponse>> GetUserJWTWithHttpInfoAsync(string userId, string userSecret, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            // verify the required parameter 'userId' is set
            if (userId == null)
            {
                throw new SnapTrade.Net.Client.ApiException(400, "Missing required parameter 'userId' when calling AuthenticationApi->GetUserJWT");
            }

            // verify the required parameter 'userSecret' is set
            if (userSecret == null)
            {
                throw new SnapTrade.Net.Client.ApiException(400, "Missing required parameter 'userSecret' when calling AuthenticationApi->GetUserJWT");
            }


            SnapTrade.Net.Client.RequestOptions localVarRequestOptions = new SnapTrade.Net.Client.RequestOptions();

            string[] _contentTypes = new string[] {
            };

            // to determine the Accept header
            string[] _accepts = new string[] {
                "application/json"
            };

            var localVarContentType = SnapTrade.Net.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = SnapTrade.Net.Client.ClientUtils.SelectHeaderAccept(_accepts);
            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "userId", userId, ""));
            localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "userSecret", userSecret, ""));

            localVarRequestOptions.Operation = "AuthenticationApi.GetUserJWT";
            localVarRequestOptions.OperationIndex = operationIndex;

            // authentication (PartnerClientId) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("clientId")))
            {
                localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "clientId", this.Configuration.GetApiKeyWithPrefix("clientId")));
            }
            // authentication (PartnerSignature) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Signature")))
            {
                localVarRequestOptions.HeaderParameters.Add("Signature", this.Configuration.GetApiKeyWithPrefix("Signature"));
            }
            // authentication (PartnerTimestamp) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("timestamp")))
            {
                localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "timestamp", this.Configuration.GetApiKeyWithPrefix("timestamp")));
            }

            // make the HTTP request
            var localVarResponse = await this.AsynchronousClient.GetAsync<EncryptedResponse>("/snapTrade/encryptedJWT", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("GetUserJWT", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return localVarResponse;
        }

        /// <summary>
        /// Get a list of all SnapTrade users you&#39;ve registered on our platform 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>List&lt;string&gt;</returns>
        public List<string> ListSnapTradeUsers(int operationIndex = 0)
        {
            SnapTrade.Net.Client.ApiResponse<List<string>> localVarResponse = ListSnapTradeUsersWithHttpInfo();
            return localVarResponse.Data;
        }

        /// <summary>
        /// Get a list of all SnapTrade users you&#39;ve registered on our platform 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>ApiResponse of List&lt;string&gt;</returns>
        public SnapTrade.Net.Client.ApiResponse<List<string>> ListSnapTradeUsersWithHttpInfo(int operationIndex = 0)
        {
            SnapTrade.Net.Client.RequestOptions localVarRequestOptions = new SnapTrade.Net.Client.RequestOptions();

            string[] _contentTypes = new string[] {
            };

            // to determine the Accept header
            string[] _accepts = new string[] {
                "application/json"
            };

            var localVarContentType = SnapTrade.Net.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = SnapTrade.Net.Client.ClientUtils.SelectHeaderAccept(_accepts);
            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }


            localVarRequestOptions.Operation = "AuthenticationApi.ListSnapTradeUsers";
            localVarRequestOptions.OperationIndex = operationIndex;

            // authentication (PartnerClientId) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("clientId")))
            {
                localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "clientId", this.Configuration.GetApiKeyWithPrefix("clientId")));
            }
            // authentication (PartnerSignature) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Signature")))
            {
                localVarRequestOptions.HeaderParameters.Add("Signature", this.Configuration.GetApiKeyWithPrefix("Signature"));
            }
            // authentication (PartnerTimestamp) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("timestamp")))
            {
                localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "timestamp", this.Configuration.GetApiKeyWithPrefix("timestamp")));
            }

            // make the HTTP request
            var localVarResponse = this.Client.Get<List<string>>("/snapTrade/listUsers", localVarRequestOptions, this.Configuration);
            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("ListSnapTradeUsers", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return localVarResponse;
        }

        /// <summary>
        /// Get a list of all SnapTrade users you&#39;ve registered on our platform 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of List&lt;string&gt;</returns>
        public async System.Threading.Tasks.Task<List<string>> ListSnapTradeUsersAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            SnapTrade.Net.Client.ApiResponse<List<string>> localVarResponse = await ListSnapTradeUsersWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false);
            return localVarResponse.Data;
        }

        /// <summary>
        /// Get a list of all SnapTrade users you&#39;ve registered on our platform 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of ApiResponse (List&lt;string&gt;)</returns>
        public async System.Threading.Tasks.Task<SnapTrade.Net.Client.ApiResponse<List<string>>> ListSnapTradeUsersWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {

            SnapTrade.Net.Client.RequestOptions localVarRequestOptions = new SnapTrade.Net.Client.RequestOptions();

            string[] _contentTypes = new string[] {
            };

            // to determine the Accept header
            string[] _accepts = new string[] {
                "application/json"
            };

            var localVarContentType = SnapTrade.Net.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = SnapTrade.Net.Client.ClientUtils.SelectHeaderAccept(_accepts);
            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }


            localVarRequestOptions.Operation = "AuthenticationApi.ListSnapTradeUsers";
            localVarRequestOptions.OperationIndex = operationIndex;

            // authentication (PartnerClientId) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("clientId")))
            {
                localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "clientId", this.Configuration.GetApiKeyWithPrefix("clientId")));
            }
            // authentication (PartnerSignature) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Signature")))
            {
                localVarRequestOptions.HeaderParameters.Add("Signature", this.Configuration.GetApiKeyWithPrefix("Signature"));
            }
            // authentication (PartnerTimestamp) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("timestamp")))
            {
                localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "timestamp", this.Configuration.GetApiKeyWithPrefix("timestamp")));
            }

            // make the HTTP request
            var localVarResponse = await this.AsynchronousClient.GetAsync<List<string>>("/snapTrade/listUsers", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("ListSnapTradeUsers", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return localVarResponse;
        }

        /// <summary>
        /// Generate a redirect URI to securely login a user to the SnapTrade Connection Portal 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="userId"></param>
        /// <param name="userSecret"></param>
        /// <param name="snapTradeLoginUserRequestBody"> (optional)</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>AuthenticationLoginSnapTradeUser200Response</returns>
        public AuthenticationLoginSnapTradeUser200Response LoginSnapTradeUser(string userId, string userSecret, SnapTradeLoginUserRequestBody snapTradeLoginUserRequestBody = default(SnapTradeLoginUserRequestBody), int operationIndex = 0)
        {
            SnapTrade.Net.Client.ApiResponse<AuthenticationLoginSnapTradeUser200Response> localVarResponse = LoginSnapTradeUserWithHttpInfo(userId, userSecret, snapTradeLoginUserRequestBody);
            return localVarResponse.Data;
        }

        /// <summary>
        /// Generate a redirect URI to securely login a user to the SnapTrade Connection Portal 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="userId"></param>
        /// <param name="userSecret"></param>
        /// <param name="snapTradeLoginUserRequestBody"> (optional)</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>ApiResponse of AuthenticationLoginSnapTradeUser200Response</returns>
        public SnapTrade.Net.Client.ApiResponse<AuthenticationLoginSnapTradeUser200Response> LoginSnapTradeUserWithHttpInfo(string userId, string userSecret, SnapTradeLoginUserRequestBody snapTradeLoginUserRequestBody = default(SnapTradeLoginUserRequestBody), int operationIndex = 0)
        {
            // verify the required parameter 'userId' is set
            if (userId == null)
            {
                throw new SnapTrade.Net.Client.ApiException(400, "Missing required parameter 'userId' when calling AuthenticationApi->LoginSnapTradeUser");
            }

            // verify the required parameter 'userSecret' is set
            if (userSecret == null)
            {
                throw new SnapTrade.Net.Client.ApiException(400, "Missing required parameter 'userSecret' when calling AuthenticationApi->LoginSnapTradeUser");
            }

            SnapTrade.Net.Client.RequestOptions localVarRequestOptions = new SnapTrade.Net.Client.RequestOptions();

            string[] _contentTypes = new string[] {
                "application/json"
            };

            // to determine the Accept header
            string[] _accepts = new string[] {
                "application/json"
            };

            var localVarContentType = SnapTrade.Net.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = SnapTrade.Net.Client.ClientUtils.SelectHeaderAccept(_accepts);
            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "userId", userId, ""));
            localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "userSecret", userSecret, ""));
            localVarRequestOptions.Data = snapTradeLoginUserRequestBody;

            localVarRequestOptions.Operation = "AuthenticationApi.LoginSnapTradeUser";
            localVarRequestOptions.OperationIndex = operationIndex;

            // authentication (PartnerClientId) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("clientId")))
            {
                localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "clientId", this.Configuration.GetApiKeyWithPrefix("clientId")));
            }
            // authentication (PartnerSignature) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Signature")))
            {
                localVarRequestOptions.HeaderParameters.Add("Signature", this.Configuration.GetApiKeyWithPrefix("Signature"));
            }
            // authentication (PartnerTimestamp) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("timestamp")))
            {
                localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "timestamp", this.Configuration.GetApiKeyWithPrefix("timestamp")));
            }

            // make the HTTP request
            var localVarResponse = this.Client.Post<AuthenticationLoginSnapTradeUser200Response>("/snapTrade/login", localVarRequestOptions, this.Configuration);
            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("LoginSnapTradeUser", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return localVarResponse;
        }

        /// <summary>
        /// Generate a redirect URI to securely login a user to the SnapTrade Connection Portal 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="userId"></param>
        /// <param name="userSecret"></param>
        /// <param name="snapTradeLoginUserRequestBody"> (optional)</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of AuthenticationLoginSnapTradeUser200Response</returns>
        public async System.Threading.Tasks.Task<AuthenticationLoginSnapTradeUser200Response> LoginSnapTradeUserAsync(string userId, string userSecret, SnapTradeLoginUserRequestBody snapTradeLoginUserRequestBody = default(SnapTradeLoginUserRequestBody), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            SnapTrade.Net.Client.ApiResponse<AuthenticationLoginSnapTradeUser200Response> localVarResponse = await LoginSnapTradeUserWithHttpInfoAsync(userId, userSecret, snapTradeLoginUserRequestBody, operationIndex, cancellationToken).ConfigureAwait(false);
            return localVarResponse.Data;
        }

        /// <summary>
        /// Generate a redirect URI to securely login a user to the SnapTrade Connection Portal 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="userId"></param>
        /// <param name="userSecret"></param>
        /// <param name="snapTradeLoginUserRequestBody"> (optional)</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of ApiResponse (AuthenticationLoginSnapTradeUser200Response)</returns>
        public async System.Threading.Tasks.Task<SnapTrade.Net.Client.ApiResponse<AuthenticationLoginSnapTradeUser200Response>> LoginSnapTradeUserWithHttpInfoAsync(string userId, string userSecret, SnapTradeLoginUserRequestBody snapTradeLoginUserRequestBody = default(SnapTradeLoginUserRequestBody), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            // verify the required parameter 'userId' is set
            if (userId == null)
            {
                throw new SnapTrade.Net.Client.ApiException(400, "Missing required parameter 'userId' when calling AuthenticationApi->LoginSnapTradeUser");
            }

            // verify the required parameter 'userSecret' is set
            if (userSecret == null)
            {
                throw new SnapTrade.Net.Client.ApiException(400, "Missing required parameter 'userSecret' when calling AuthenticationApi->LoginSnapTradeUser");
            }


            SnapTrade.Net.Client.RequestOptions localVarRequestOptions = new SnapTrade.Net.Client.RequestOptions();

            string[] _contentTypes = new string[] {
                "application/json"
            };

            // to determine the Accept header
            string[] _accepts = new string[] {
                "application/json"
            };

            var localVarContentType = SnapTrade.Net.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = SnapTrade.Net.Client.ClientUtils.SelectHeaderAccept(_accepts);
            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "userId", userId, ""));
            localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "userSecret", userSecret, ""));
            localVarRequestOptions.Data = snapTradeLoginUserRequestBody;

            localVarRequestOptions.Operation = "AuthenticationApi.LoginSnapTradeUser";
            localVarRequestOptions.OperationIndex = operationIndex;

            // authentication (PartnerClientId) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("clientId")))
            {
                localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "clientId", this.Configuration.GetApiKeyWithPrefix("clientId")));
            }
            // authentication (PartnerSignature) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Signature")))
            {
                localVarRequestOptions.HeaderParameters.Add("Signature", this.Configuration.GetApiKeyWithPrefix("Signature"));
            }
            // authentication (PartnerTimestamp) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("timestamp")))
            {
                localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "timestamp", this.Configuration.GetApiKeyWithPrefix("timestamp")));
            }

            // make the HTTP request
            var localVarResponse = await this.AsynchronousClient.PostAsync<AuthenticationLoginSnapTradeUser200Response>("/snapTrade/login", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("LoginSnapTradeUser", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return localVarResponse;
        }

        /// <summary>
        /// Register user with SnapTrade in order to create secure brokerage authorizations 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="snapTradeRegisterUserRequestBody"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>UserIDandSecret</returns>
        public UserIDandSecret RegisterSnapTradeUser(SnapTradeRegisterUserRequestBody snapTradeRegisterUserRequestBody, int operationIndex = 0)
        {
            SnapTrade.Net.Client.ApiResponse<UserIDandSecret> localVarResponse = RegisterSnapTradeUserWithHttpInfo(snapTradeRegisterUserRequestBody);
            return localVarResponse.Data;
        }

        /// <summary>
        /// Register user with SnapTrade in order to create secure brokerage authorizations 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="snapTradeRegisterUserRequestBody"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>ApiResponse of UserIDandSecret</returns>
        public SnapTrade.Net.Client.ApiResponse<UserIDandSecret> RegisterSnapTradeUserWithHttpInfo(SnapTradeRegisterUserRequestBody snapTradeRegisterUserRequestBody, int operationIndex = 0)
        {
            // verify the required parameter 'snapTradeRegisterUserRequestBody' is set
            if (snapTradeRegisterUserRequestBody == null)
            {
                throw new SnapTrade.Net.Client.ApiException(400, "Missing required parameter 'snapTradeRegisterUserRequestBody' when calling AuthenticationApi->RegisterSnapTradeUser");
            }

            SnapTrade.Net.Client.RequestOptions localVarRequestOptions = new SnapTrade.Net.Client.RequestOptions();

            string[] _contentTypes = new string[] {
                "application/json"
            };

            // to determine the Accept header
            string[] _accepts = new string[] {
                "application/json"
            };

            var localVarContentType = SnapTrade.Net.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = SnapTrade.Net.Client.ClientUtils.SelectHeaderAccept(_accepts);
            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            localVarRequestOptions.Data = snapTradeRegisterUserRequestBody;

            localVarRequestOptions.Operation = "AuthenticationApi.RegisterSnapTradeUser";
            localVarRequestOptions.OperationIndex = operationIndex;

            // authentication (PartnerClientId) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("clientId")))
            {
                localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "clientId", this.Configuration.GetApiKeyWithPrefix("clientId")));
            }
            // authentication (PartnerSignature) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Signature")))
            {
                localVarRequestOptions.HeaderParameters.Add("Signature", this.Configuration.GetApiKeyWithPrefix("Signature"));
            }
            // authentication (PartnerTimestamp) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("timestamp")))
            {
                localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "timestamp", this.Configuration.GetApiKeyWithPrefix("timestamp")));
            }

            // make the HTTP request
            var localVarResponse = this.Client.Post<UserIDandSecret>("/snapTrade/registerUser", localVarRequestOptions, this.Configuration);
            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("RegisterSnapTradeUser", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return localVarResponse;
        }

        /// <summary>
        /// Register user with SnapTrade in order to create secure brokerage authorizations 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="snapTradeRegisterUserRequestBody"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of UserIDandSecret</returns>
        public async System.Threading.Tasks.Task<UserIDandSecret> RegisterSnapTradeUserAsync(SnapTradeRegisterUserRequestBody snapTradeRegisterUserRequestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            SnapTrade.Net.Client.ApiResponse<UserIDandSecret> localVarResponse = await RegisterSnapTradeUserWithHttpInfoAsync(snapTradeRegisterUserRequestBody, operationIndex, cancellationToken).ConfigureAwait(false);
            return localVarResponse.Data;
        }

        /// <summary>
        /// Register user with SnapTrade in order to create secure brokerage authorizations 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="snapTradeRegisterUserRequestBody"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of ApiResponse (UserIDandSecret)</returns>
        public async System.Threading.Tasks.Task<SnapTrade.Net.Client.ApiResponse<UserIDandSecret>> RegisterSnapTradeUserWithHttpInfoAsync(SnapTradeRegisterUserRequestBody snapTradeRegisterUserRequestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            // verify the required parameter 'snapTradeRegisterUserRequestBody' is set
            if (snapTradeRegisterUserRequestBody == null)
            {
                throw new SnapTrade.Net.Client.ApiException(400, "Missing required parameter 'snapTradeRegisterUserRequestBody' when calling AuthenticationApi->RegisterSnapTradeUser");
            }


            SnapTrade.Net.Client.RequestOptions localVarRequestOptions = new SnapTrade.Net.Client.RequestOptions();

            string[] _contentTypes = new string[] {
                "application/json"
            };

            // to determine the Accept header
            string[] _accepts = new string[] {
                "application/json"
            };

            var localVarContentType = SnapTrade.Net.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = SnapTrade.Net.Client.ClientUtils.SelectHeaderAccept(_accepts);
            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            localVarRequestOptions.Data = snapTradeRegisterUserRequestBody;

            localVarRequestOptions.Operation = "AuthenticationApi.RegisterSnapTradeUser";
            localVarRequestOptions.OperationIndex = operationIndex;

            // authentication (PartnerClientId) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("clientId")))
            {
                localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "clientId", this.Configuration.GetApiKeyWithPrefix("clientId")));
            }
            // authentication (PartnerSignature) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Signature")))
            {
                localVarRequestOptions.HeaderParameters.Add("Signature", this.Configuration.GetApiKeyWithPrefix("Signature"));
            }
            // authentication (PartnerTimestamp) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("timestamp")))
            {
                localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "timestamp", this.Configuration.GetApiKeyWithPrefix("timestamp")));
            }

            // make the HTTP request
            var localVarResponse = await this.AsynchronousClient.PostAsync<UserIDandSecret>("/snapTrade/registerUser", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("RegisterSnapTradeUser", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return localVarResponse;
        }

    }
}
