コード例 #1
0
        public EvadaClient(HttpClient httpClient, EvadaOptions options)
        {
            if (httpClient == null)
            {
                throw new ArgumentNullException(nameof(httpClient));
            }

            _options = options ?? throw new ArgumentNullException(nameof(options));

            var url   = !string.IsNullOrEmpty(options.BaseUrl) ? options.BaseUrl : options.UsePreviewApi ? PreviewApiUrl : DeliveryApiUrl;
            var token = options.UsePreviewApi ? options.PreviewApiToken : options.DeliveryApiToken;

            _apiConnection = new ApiConnection(httpClient, token, url, DiagnosticsHeader.Default, null);

            Items = new ItemService(_apiConnection, options);
        }
コード例 #2
0
 /// <summary>
 /// Creates a new instance of the <see cref="ItemService"/> class.
 /// </summary>
 /// <param name="connection">The <see cref="IApiConnection" /> which is used to communicate with the API.</param>
 /// <param name="options">Evada options</param>
 public ItemService(IApiConnection connection, EvadaOptions options)
     : base(connection)
 {
     _containerId = options.ContainerId;
 }