Ejemplo n.º 1
0
        internal static void CheckConfig(this ZohoConfig configuration)
        {
            if (null == configuration)
            {
                throw new ArgumentException("Zoho API configurations missing or not set before making API call");
            }

            if (string.IsNullOrEmpty(configuration.OrganizationId) || configuration.OrganizationId.Trim() == string.Empty)
            {
                throw new ArgumentNullException("Zoho API configuration - Organization Id cannot be null");
            }

            if (string.IsNullOrEmpty(configuration.AuthToken) || configuration.AuthToken.Trim() == string.Empty)
            {
                throw new ArgumentNullException("Zoho API configuration - Authorization token cannot be null");
            }

            if (string.IsNullOrEmpty(configuration.ApiBaseUrl) || configuration.ApiBaseUrl.Trim() == string.Empty || !Uri.IsWellFormedUriString(configuration.ApiBaseUrl, UriKind.RelativeOrAbsolute))
            {
                throw new ArgumentNullException("Zoho API configuration - API base URL is not well formed URI");
            }
        }
Ejemplo n.º 2
0
 public ZohoClient(ZohoConfig configuration) : this()
 {
     configuration.CheckConfig();
     this.Configuration = configuration;
 }