/// <summary>
        /// IndicoClient constructor
        /// </summary>
        /// <param name="indicoConfig">Client configuration with platform hostname, etc</param>
        public IndicoClient(IndicoConfig indicoConfig = null)
        {
            if (indicoConfig != null)
            {
                this.Config = indicoConfig;
            }
            else
            {
                this.Config = new IndicoConfig();
            }

            HttpMessageHandler handler = this.GetHandler();

            this.HttpClient = new HttpClient(handler);
            string endpoint = $"{this.Config.Protocol}://{this.Config.Host}";
            GraphQLHttpClientOptions options = new GraphQLHttpClientOptions();

            options.EndPoint           = new System.Uri($"{endpoint}/graph/api/graphql");
            options.HttpMessageHandler = handler;
            this.GraphQLHttpClient     = this.HttpClient.AsGraphQLClient(options);
        }
Esempio n. 2
0
        /// <summary>
        /// IndicoClient constructor
        /// </summary>
        /// <param name="indicoConfig">Client configuration with platform hostname, etc</param>
        public IndicoClient(IndicoConfig indicoConfig = null)
        {
            if (indicoConfig != null)
            {
                Config = indicoConfig;
            }
            else
            {
                Config = new IndicoConfig();
            }

            var handler = GetHandler();

            HttpClient = new HttpClient(handler);
            string endpoint = $"{Config.Protocol}://{Config.Host}";
            var    options  = new GraphQLHttpClientOptions
            {
                EndPoint           = new System.Uri($"{endpoint}/graph/api/graphql"),
                HttpMessageHandler = handler
            };

            GraphQLHttpClient = new GraphQLHttpClient(options, new NewtonsoftJsonSerializer(), HttpClient);
        }