cs_api_dotnet.CaseStackApi.GetRestClient C# (CSharp) Method

GetRestClient() private method

private GetRestClient ( ) : RestSharp.RestClient
return RestSharp.RestClient
        private RestClient GetRestClient()
        {
            if (String.IsNullOrEmpty(_apiEndpoint) || String.IsNullOrEmpty(_companyId) ||
                String.IsNullOrEmpty(_apiKey))
                throw new ApplicationException(
                    "API Client is not properly Initialized. Please set credentials and environment");

            var client = new RestClient
            {
                BaseUrl = new Uri(_apiEndpoint),
                Authenticator = new HttpBasicAuthenticator(_companyId, _apiKey)
            };
            client.AddDefaultHeader("Accept-Version", _apiVersion);
            return client;
        }