예제 #1
0
            /// <summary>
            /// Set the log format string to be used by the SDK.
            /// </summary>
            /// <param name="format">The log level to use.</param>
            /// <returns>Updated builder.</returns>
            public Builder SetLogFormat(string format)
            {
                if (format is null)
                {
                    throw new ArgumentNullException(nameof(format));
                }

                _context = HttpContextModule.withLogFormat(format, _context);
                return(this);
            }
예제 #2
0
            /// <summary>
            /// Set the metrics handler to be used by the SDK.
            /// </summary>
            /// <param name="metrics">The metrics handler to use.</param>
            /// <returns>Updated builder.</returns>
            public Builder SetMetrics(IMetrics metrics)
            {
                if (metrics is null)
                {
                    throw new ArgumentNullException(nameof(metrics));
                }

                _context = HttpContextModule.withMetrics(metrics, _context);
                return(this);
            }
예제 #3
0
            /// <summary>
            /// Set the logger to be used by the SDK.
            /// </summary>
            /// <param name="logger">The logger to use.</param>
            /// <returns>Updated builder.</returns>
            public Builder SetLogger(ILogger logger)
            {
                if (logger is null)
                {
                    throw new ArgumentNullException(nameof(logger));
                }

                _context = HttpContextModule.withLogger(logger, _context);
                return(this);
            }
예제 #4
0
            /// <summary>
            /// Set the HTTP client to use.
            /// </summary>
            /// <param name="client">The HttpClient to use</param>
            /// <returns>Updated builder.</returns>
            public Builder SetHttpClient(HttpClient client)
            {
                if (client is null)
                {
                    throw new ArgumentNullException(nameof(client));
                }

                _context = HttpContextModule.withHttpClient(client, _context);
                return(this);
            }
예제 #5
0
            /// <summary>
            /// Add header for accessing the API.
            /// </summary>
            /// <param name="name">Name of the header</param>
            /// <param name="value">Value of the header</param>
            /// <returns>Updated builder.</returns>
            public Builder AddHeader(string name, string value)
            {
                if (name is null)
                {
                    throw new ArgumentNullException(nameof(name));
                }

                if (value is null)
                {
                    throw new ArgumentNullException(nameof(value));
                }

                _context = HttpContextModule.withHeader(name, value, _context);
                return(this);
            }
예제 #6
0
 /// <summary>
 /// Set the log level to be used by the SDK.
 /// </summary>
 /// <param name="logLevel">The log level to use.</param>
 /// <returns>Updated builder.</returns>
 public Builder SetLogLevel(LogLevel logLevel)
 {
     _context = HttpContextModule.withLogLevel(logLevel, _context);
     return(this);
 }
예제 #7
0
 /// <summary>
 /// Create Client builder.
 /// </summary>
 /// <param name="httpClient">Optional HttpClient to use for HTTP requests.</param>
 public Builder(HttpClient httpClient = null)
 {
     _context = httpClient == null ? _context : HttpContextModule.withHttpClient(httpClient, _context);
 }