<reponame>passiv/snaptrade-sdks<gh_stars>0/*
 * SnapTrade
 *
 * Connect brokerage accounts to your app for live positions and trading
 *
 * The version of the OpenAPI document: 1.0.0
 * Contact: upchh@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 IConnectionsApiSync : IApiAccessor
    {
        #region Synchronous Operations
        /// <summary>
        /// Get detail of a specific brokerage authorizations for the user
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="authorizationId">The ID of a brokerage authorization object.</param>
        /// <param name="userId"></param>
        /// <param name="userSecret"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>BrokerageAuthorization</returns>
        BrokerageAuthorization DetailBrokerageAuthorization(Guid authorizationId, string userId, string userSecret, int operationIndex = 0);

        /// <summary>
        /// Get detail of a specific brokerage authorizations for the user
        /// </summary>
        /// <remarks>
        /// 
        /// </remarks>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="authorizationId">The ID of a brokerage authorization object.</param>
        /// <param name="userId"></param>
        /// <param name="userSecret"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>ApiResponse of BrokerageAuthorization</returns>
        ApiResponse<BrokerageAuthorization> DetailBrokerageAuthorizationWithHttpInfo(Guid authorizationId, string userId, string userSecret, int operationIndex = 0);
        /// <summary>
        /// List all brokerage authorizations for the user
        /// </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>List&lt;BrokerageAuthorization&gt;</returns>
        List<BrokerageAuthorization> ListBrokerageAuthorizations(string userId, string userSecret, int operationIndex = 0);

        /// <summary>
        /// List all brokerage authorizations for 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="userSecret"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>ApiResponse of List&lt;BrokerageAuthorization&gt;</returns>
        ApiResponse<List<BrokerageAuthorization>> ListBrokerageAuthorizationsWithHttpInfo(string userId, string userSecret, int operationIndex = 0);
        /// <summary>
        /// Remove a brokerage authorization.
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="authorizationId">The ID of the Authorization to delete.</param>
        /// <param name="userId"></param>
        /// <param name="userSecret"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns></returns>
        void RemoveBrokerageAuthorization(Guid authorizationId, string userId, string userSecret, int operationIndex = 0);

        /// <summary>
        /// Remove a brokerage authorization.
        /// </summary>
        /// <remarks>
        /// 
        /// </remarks>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="authorizationId">The ID of the Authorization to delete.</param>
        /// <param name="userId"></param>
        /// <param name="userSecret"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>ApiResponse of Object(void)</returns>
        ApiResponse<Object> RemoveBrokerageAuthorizationWithHttpInfo(Guid authorizationId, string userId, string userSecret, int operationIndex = 0);
        /// <summary>
        /// List all session events for the partner
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="partnerClientId"></param>
        /// <param name="userId">Optional comma seperated list of user IDs used to filter the request on specific users (optional)</param>
        /// <param name="sessionId">Optional comma seperated list of session IDs used to filter the request on specific users (optional)</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>List&lt;ConnectionsSessionEvents200ResponseInner&gt;</returns>
        List<ConnectionsSessionEvents200ResponseInner> SessionEvents(string partnerClientId, string userId = default(string), string sessionId = default(string), int operationIndex = 0);

        /// <summary>
        /// List all session events for the partner
        /// </summary>
        /// <remarks>
        /// 
        /// </remarks>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="partnerClientId"></param>
        /// <param name="userId">Optional comma seperated list of user IDs used to filter the request on specific users (optional)</param>
        /// <param name="sessionId">Optional comma seperated list of session IDs used to filter the request on specific users (optional)</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>ApiResponse of List&lt;ConnectionsSessionEvents200ResponseInner&gt;</returns>
        ApiResponse<List<ConnectionsSessionEvents200ResponseInner>> SessionEventsWithHttpInfo(string partnerClientId, string userId = default(string), string sessionId = default(string), int operationIndex = 0);
        #endregion Synchronous Operations
    }

    /// <summary>
    /// Represents a collection of functions to interact with the API endpoints
    /// </summary>
    public interface IConnectionsApiAsync : IApiAccessor
    {
        #region Asynchronous Operations
        /// <summary>
        /// Get detail of a specific brokerage authorizations for the user
        /// </summary>
        /// <remarks>
        /// 
        /// </remarks>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="authorizationId">The ID of a brokerage authorization object.</param>
        /// <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 BrokerageAuthorization</returns>
        System.Threading.Tasks.Task<BrokerageAuthorization> DetailBrokerageAuthorizationAsync(Guid authorizationId, string userId, string userSecret, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));

        /// <summary>
        /// Get detail of a specific brokerage authorizations for the user
        /// </summary>
        /// <remarks>
        /// 
        /// </remarks>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="authorizationId">The ID of a brokerage authorization object.</param>
        /// <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 (BrokerageAuthorization)</returns>
        System.Threading.Tasks.Task<ApiResponse<BrokerageAuthorization>> DetailBrokerageAuthorizationWithHttpInfoAsync(Guid authorizationId, string userId, string userSecret, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
        /// <summary>
        /// List all brokerage authorizations for 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="userSecret"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of List&lt;BrokerageAuthorization&gt;</returns>
        System.Threading.Tasks.Task<List<BrokerageAuthorization>> ListBrokerageAuthorizationsAsync(string userId, string userSecret, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));

        /// <summary>
        /// List all brokerage authorizations for 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="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 (List&lt;BrokerageAuthorization&gt;)</returns>
        System.Threading.Tasks.Task<ApiResponse<List<BrokerageAuthorization>>> ListBrokerageAuthorizationsWithHttpInfoAsync(string userId, string userSecret, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
        /// <summary>
        /// Remove a brokerage authorization.
        /// </summary>
        /// <remarks>
        /// 
        /// </remarks>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="authorizationId">The ID of the Authorization to delete.</param>
        /// <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 void</returns>
        System.Threading.Tasks.Task RemoveBrokerageAuthorizationAsync(Guid authorizationId, string userId, string userSecret, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));

        /// <summary>
        /// Remove a brokerage authorization.
        /// </summary>
        /// <remarks>
        /// 
        /// </remarks>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="authorizationId">The ID of the Authorization to delete.</param>
        /// <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</returns>
        System.Threading.Tasks.Task<ApiResponse<Object>> RemoveBrokerageAuthorizationWithHttpInfoAsync(Guid authorizationId, string userId, string userSecret, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
        /// <summary>
        /// List all session events for the partner
        /// </summary>
        /// <remarks>
        /// 
        /// </remarks>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="partnerClientId"></param>
        /// <param name="userId">Optional comma seperated list of user IDs used to filter the request on specific users (optional)</param>
        /// <param name="sessionId">Optional comma seperated list of session IDs used to filter the request on specific users (optional)</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of List&lt;ConnectionsSessionEvents200ResponseInner&gt;</returns>
        System.Threading.Tasks.Task<List<ConnectionsSessionEvents200ResponseInner>> SessionEventsAsync(string partnerClientId, string userId = default(string), string sessionId = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));

        /// <summary>
        /// List all session events for the partner
        /// </summary>
        /// <remarks>
        /// 
        /// </remarks>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="partnerClientId"></param>
        /// <param name="userId">Optional comma seperated list of user IDs used to filter the request on specific users (optional)</param>
        /// <param name="sessionId">Optional comma seperated list of session IDs used to filter the request on specific users (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 (List&lt;ConnectionsSessionEvents200ResponseInner&gt;)</returns>
        System.Threading.Tasks.Task<ApiResponse<List<ConnectionsSessionEvents200ResponseInner>>> SessionEventsWithHttpInfoAsync(string partnerClientId, string userId = default(string), string sessionId = default(string), 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 IConnectionsApi : IConnectionsApiSync, IConnectionsApiAsync
    {

    }

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

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

        /// <summary>
        /// Initializes a new instance of the <see cref="ConnectionsApi"/> class.
        /// </summary>
        /// <returns></returns>
        public ConnectionsApi(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="ConnectionsApi"/> class
        /// using Configuration object
        /// </summary>
        /// <param name="configuration">An instance of Configuration</param>
        /// <returns></returns>
        public ConnectionsApi(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="ConnectionsApi"/> 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 ConnectionsApi(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>
        /// Get detail of a specific brokerage authorizations for the user 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="authorizationId">The ID of a brokerage authorization object.</param>
        /// <param name="userId"></param>
        /// <param name="userSecret"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>BrokerageAuthorization</returns>
        public BrokerageAuthorization DetailBrokerageAuthorization(Guid authorizationId, string userId, string userSecret, int operationIndex = 0)
        {
            SnapTrade.Net.Client.ApiResponse<BrokerageAuthorization> localVarResponse = DetailBrokerageAuthorizationWithHttpInfo(authorizationId, userId, userSecret);
            return localVarResponse.Data;
        }

        /// <summary>
        /// Get detail of a specific brokerage authorizations for the user 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="authorizationId">The ID of a brokerage authorization object.</param>
        /// <param name="userId"></param>
        /// <param name="userSecret"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>ApiResponse of BrokerageAuthorization</returns>
        public SnapTrade.Net.Client.ApiResponse<BrokerageAuthorization> DetailBrokerageAuthorizationWithHttpInfo(Guid authorizationId, 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 ConnectionsApi->DetailBrokerageAuthorization");
            }

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

            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.PathParameters.Add("authorizationId", SnapTrade.Net.Client.ClientUtils.ParameterToString(authorizationId)); // path parameter
            localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "userId", userId, ""));
            localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "userSecret", userSecret, ""));

            localVarRequestOptions.Operation = "ConnectionsApi.DetailBrokerageAuthorization";
            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<BrokerageAuthorization>("/authorizations/{authorizationId}", localVarRequestOptions, this.Configuration);
            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("DetailBrokerageAuthorization", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return localVarResponse;
        }

        /// <summary>
        /// Get detail of a specific brokerage authorizations for the user 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="authorizationId">The ID of a brokerage authorization object.</param>
        /// <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 BrokerageAuthorization</returns>
        public async System.Threading.Tasks.Task<BrokerageAuthorization> DetailBrokerageAuthorizationAsync(Guid authorizationId, string userId, string userSecret, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            SnapTrade.Net.Client.ApiResponse<BrokerageAuthorization> localVarResponse = await DetailBrokerageAuthorizationWithHttpInfoAsync(authorizationId, userId, userSecret, operationIndex, cancellationToken).ConfigureAwait(false);
            return localVarResponse.Data;
        }

        /// <summary>
        /// Get detail of a specific brokerage authorizations for the user 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="authorizationId">The ID of a brokerage authorization object.</param>
        /// <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 (BrokerageAuthorization)</returns>
        public async System.Threading.Tasks.Task<SnapTrade.Net.Client.ApiResponse<BrokerageAuthorization>> DetailBrokerageAuthorizationWithHttpInfoAsync(Guid authorizationId, 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 ConnectionsApi->DetailBrokerageAuthorization");
            }

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


            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.PathParameters.Add("authorizationId", SnapTrade.Net.Client.ClientUtils.ParameterToString(authorizationId)); // path parameter
            localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "userId", userId, ""));
            localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "userSecret", userSecret, ""));

            localVarRequestOptions.Operation = "ConnectionsApi.DetailBrokerageAuthorization";
            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<BrokerageAuthorization>("/authorizations/{authorizationId}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);

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

            return localVarResponse;
        }

        /// <summary>
        /// List all brokerage authorizations for the user 
        /// </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>List&lt;BrokerageAuthorization&gt;</returns>
        public List<BrokerageAuthorization> ListBrokerageAuthorizations(string userId, string userSecret, int operationIndex = 0)
        {
            SnapTrade.Net.Client.ApiResponse<List<BrokerageAuthorization>> localVarResponse = ListBrokerageAuthorizationsWithHttpInfo(userId, userSecret);
            return localVarResponse.Data;
        }

        /// <summary>
        /// List all brokerage authorizations for the user 
        /// </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 List&lt;BrokerageAuthorization&gt;</returns>
        public SnapTrade.Net.Client.ApiResponse<List<BrokerageAuthorization>> ListBrokerageAuthorizationsWithHttpInfo(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 ConnectionsApi->ListBrokerageAuthorizations");
            }

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

            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 = "ConnectionsApi.ListBrokerageAuthorizations";
            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<BrokerageAuthorization>>("/authorizations", localVarRequestOptions, this.Configuration);
            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("ListBrokerageAuthorizations", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return localVarResponse;
        }

        /// <summary>
        /// List all brokerage authorizations for the user 
        /// </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 List&lt;BrokerageAuthorization&gt;</returns>
        public async System.Threading.Tasks.Task<List<BrokerageAuthorization>> ListBrokerageAuthorizationsAsync(string userId, string userSecret, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            SnapTrade.Net.Client.ApiResponse<List<BrokerageAuthorization>> localVarResponse = await ListBrokerageAuthorizationsWithHttpInfoAsync(userId, userSecret, operationIndex, cancellationToken).ConfigureAwait(false);
            return localVarResponse.Data;
        }

        /// <summary>
        /// List all brokerage authorizations for the user 
        /// </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 (List&lt;BrokerageAuthorization&gt;)</returns>
        public async System.Threading.Tasks.Task<SnapTrade.Net.Client.ApiResponse<List<BrokerageAuthorization>>> ListBrokerageAuthorizationsWithHttpInfoAsync(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 ConnectionsApi->ListBrokerageAuthorizations");
            }

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


            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 = "ConnectionsApi.ListBrokerageAuthorizations";
            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<BrokerageAuthorization>>("/authorizations", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);

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

            return localVarResponse;
        }

        /// <summary>
        /// Remove a brokerage authorization. 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="authorizationId">The ID of the Authorization to delete.</param>
        /// <param name="userId"></param>
        /// <param name="userSecret"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns></returns>
        public void RemoveBrokerageAuthorization(Guid authorizationId, string userId, string userSecret, int operationIndex = 0)
        {
            RemoveBrokerageAuthorizationWithHttpInfo(authorizationId, userId, userSecret);
        }

        /// <summary>
        /// Remove a brokerage authorization. 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="authorizationId">The ID of the Authorization to delete.</param>
        /// <param name="userId"></param>
        /// <param name="userSecret"></param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>ApiResponse of Object(void)</returns>
        public SnapTrade.Net.Client.ApiResponse<Object> RemoveBrokerageAuthorizationWithHttpInfo(Guid authorizationId, 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 ConnectionsApi->RemoveBrokerageAuthorization");
            }

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

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

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

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

            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.PathParameters.Add("authorizationId", SnapTrade.Net.Client.ClientUtils.ParameterToString(authorizationId)); // path parameter
            localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "userId", userId, ""));
            localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "userSecret", userSecret, ""));

            localVarRequestOptions.Operation = "ConnectionsApi.RemoveBrokerageAuthorization";
            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<Object>("/authorizations/{authorizationId}", localVarRequestOptions, this.Configuration);
            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("RemoveBrokerageAuthorization", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return localVarResponse;
        }

        /// <summary>
        /// Remove a brokerage authorization. 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="authorizationId">The ID of the Authorization to delete.</param>
        /// <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 void</returns>
        public async System.Threading.Tasks.Task RemoveBrokerageAuthorizationAsync(Guid authorizationId, string userId, string userSecret, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            await RemoveBrokerageAuthorizationWithHttpInfoAsync(authorizationId, userId, userSecret, operationIndex, cancellationToken).ConfigureAwait(false);
        }

        /// <summary>
        /// Remove a brokerage authorization. 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="authorizationId">The ID of the Authorization to delete.</param>
        /// <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</returns>
        public async System.Threading.Tasks.Task<SnapTrade.Net.Client.ApiResponse<Object>> RemoveBrokerageAuthorizationWithHttpInfoAsync(Guid authorizationId, 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 ConnectionsApi->RemoveBrokerageAuthorization");
            }

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


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

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

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

            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.PathParameters.Add("authorizationId", SnapTrade.Net.Client.ClientUtils.ParameterToString(authorizationId)); // path parameter
            localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "userId", userId, ""));
            localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "userSecret", userSecret, ""));

            localVarRequestOptions.Operation = "ConnectionsApi.RemoveBrokerageAuthorization";
            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<Object>("/authorizations/{authorizationId}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);

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

            return localVarResponse;
        }

        /// <summary>
        /// List all session events for the partner 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="partnerClientId"></param>
        /// <param name="userId">Optional comma seperated list of user IDs used to filter the request on specific users (optional)</param>
        /// <param name="sessionId">Optional comma seperated list of session IDs used to filter the request on specific users (optional)</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>List&lt;ConnectionsSessionEvents200ResponseInner&gt;</returns>
        public List<ConnectionsSessionEvents200ResponseInner> SessionEvents(string partnerClientId, string userId = default(string), string sessionId = default(string), int operationIndex = 0)
        {
            SnapTrade.Net.Client.ApiResponse<List<ConnectionsSessionEvents200ResponseInner>> localVarResponse = SessionEventsWithHttpInfo(partnerClientId, userId, sessionId);
            return localVarResponse.Data;
        }

        /// <summary>
        /// List all session events for the partner 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="partnerClientId"></param>
        /// <param name="userId">Optional comma seperated list of user IDs used to filter the request on specific users (optional)</param>
        /// <param name="sessionId">Optional comma seperated list of session IDs used to filter the request on specific users (optional)</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <returns>ApiResponse of List&lt;ConnectionsSessionEvents200ResponseInner&gt;</returns>
        public SnapTrade.Net.Client.ApiResponse<List<ConnectionsSessionEvents200ResponseInner>> SessionEventsWithHttpInfo(string partnerClientId, string userId = default(string), string sessionId = default(string), int operationIndex = 0)
        {
            // verify the required parameter 'partnerClientId' is set
            if (partnerClientId == null)
            {
                throw new SnapTrade.Net.Client.ApiException(400, "Missing required parameter 'partnerClientId' when calling ConnectionsApi->SessionEvents");
            }

            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("", "PartnerClientId", partnerClientId, ""));
            if (userId != null)
            {
                localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "userId", userId, ""));
            }
            if (sessionId != null)
            {
                localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "sessionId", sessionId, ""));
            }

            localVarRequestOptions.Operation = "ConnectionsApi.SessionEvents";
            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<ConnectionsSessionEvents200ResponseInner>>("/sessionEvents", localVarRequestOptions, this.Configuration);
            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("SessionEvents", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return localVarResponse;
        }

        /// <summary>
        /// List all session events for the partner 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="partnerClientId"></param>
        /// <param name="userId">Optional comma seperated list of user IDs used to filter the request on specific users (optional)</param>
        /// <param name="sessionId">Optional comma seperated list of session IDs used to filter the request on specific users (optional)</param>
        /// <param name="operationIndex">Index associated with the operation.</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of List&lt;ConnectionsSessionEvents200ResponseInner&gt;</returns>
        public async System.Threading.Tasks.Task<List<ConnectionsSessionEvents200ResponseInner>> SessionEventsAsync(string partnerClientId, string userId = default(string), string sessionId = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            SnapTrade.Net.Client.ApiResponse<List<ConnectionsSessionEvents200ResponseInner>> localVarResponse = await SessionEventsWithHttpInfoAsync(partnerClientId, userId, sessionId, operationIndex, cancellationToken).ConfigureAwait(false);
            return localVarResponse.Data;
        }

        /// <summary>
        /// List all session events for the partner 
        /// </summary>
        /// <exception cref="SnapTrade.Net.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="partnerClientId"></param>
        /// <param name="userId">Optional comma seperated list of user IDs used to filter the request on specific users (optional)</param>
        /// <param name="sessionId">Optional comma seperated list of session IDs used to filter the request on specific users (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 (List&lt;ConnectionsSessionEvents200ResponseInner&gt;)</returns>
        public async System.Threading.Tasks.Task<SnapTrade.Net.Client.ApiResponse<List<ConnectionsSessionEvents200ResponseInner>>> SessionEventsWithHttpInfoAsync(string partnerClientId, string userId = default(string), string sessionId = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            // verify the required parameter 'partnerClientId' is set
            if (partnerClientId == null)
            {
                throw new SnapTrade.Net.Client.ApiException(400, "Missing required parameter 'partnerClientId' when calling ConnectionsApi->SessionEvents");
            }


            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("", "PartnerClientId", partnerClientId, ""));
            if (userId != null)
            {
                localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "userId", userId, ""));
            }
            if (sessionId != null)
            {
                localVarRequestOptions.QueryParameters.Add(SnapTrade.Net.Client.ClientUtils.ParameterToMultiMap("", "sessionId", sessionId, ""));
            }

            localVarRequestOptions.Operation = "ConnectionsApi.SessionEvents";
            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<ConnectionsSessionEvents200ResponseInner>>("/sessionEvents", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);

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

            return localVarResponse;
        }

    }
}
