Пример #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);
 }
Пример #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();
            }
        }
Пример #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);
 }
Пример #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);
 }