Exemplo n.º 1
0
 private void init(CWApiSettings settings)
 {
     companyName = settings.CompanyName;
     domain      = settings.Domain.TrimEnd('/');
     cookieValue = settings.CookieValue;
     version     = settings.UriVersion;
     accept      = settings.Accept;
     auth        = settings.Authentication.BuildHeader(companyName);
 }
Exemplo n.º 2
0
        /// <summary>
        /// HttpClient used to make requests to a ConnectWise Manage API. This constructor will take a pre-instantiated System.Net.Http.HttpClient. Use this if you will be using the provided HttpClient to make requests to other APIs as well, or if you want to set different HttpClient settings. CWHttpClient will not make any changes to your provided HttpClient's default settings.
        /// </summary>
        public CWHttpClient(CWApiSettings settings, HttpClient client = null)
        {
            companyName = settings.CompanyName;
            clientId    = settings.ClientId;
            domain      = settings.Domain.TrimEnd('/');
            cookieValue = settings.CookieValue;
            version     = settings.UriVersion;
            accept      = settings.Accept;
            auth        = settings.Authentication.BuildHeader(companyName);

            // Passthrough
            if (client != null)
            {
                this.client = client;
            }
            else
            {
                ownsClient  = true;
                this.client = new HttpClient();
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// HttpClient used to make requests to a ConnectWise Manage API. This constructor will take a pre-instantiated System.Net.Http.HttpClient. Use this if you will be using the provided HttpClient to make requests to other APIs as well, or if you want to set different HttpClient settings. CWHttpClient will not make any changes to your provided HttpClient's default settings.
 /// </summary>
 public CWHttpClient(CWApiSettings settings, HttpClient client)
 {
     // Passthrough
     this.client = client;
     init(settings);
 }
Exemplo n.º 4
0
 /// <summary>
 /// HttpClient used to make requests to a ConnectWise Manage API. This constructor will create its own System.Net.Http.HttpClient internally.
 /// </summary>
 public CWHttpClient(CWApiSettings settings)
 {
     init(settings);
 }