File tree Expand file tree Collapse file tree 2 files changed +50
-15
lines changed Expand file tree Collapse file tree 2 files changed +50
-15
lines changed Original file line number Diff line number Diff line change @@ -14,28 +14,24 @@ namespace ArcadeDotnet;
1414
1515public sealed class ArcadeClient : IArcadeClient
1616{
17- public HttpClient HttpClient { get ; init ; } = new ( ) ;
17+ readonly ClientOptions _options = new ( ) ;
18+
19+ public HttpClient HttpClient
20+ {
21+ get { return this . _options . HttpClient ; }
22+ init { this . _options . HttpClient = value ; }
23+ }
1824
19- Lazy < Uri > _baseUrl = new ( ( ) =>
20- new Uri ( Environment . GetEnvironmentVariable ( "ARCADE_BASE_URL" ) ?? "https://api.arcade.dev" )
21- ) ;
2225 public Uri BaseUrl
2326 {
24- get { return _baseUrl . Value ; }
25- init { _baseUrl = new ( ( ) => value ) ; }
27+ get { return this . _options . BaseUrl ; }
28+ init { this . _options . BaseUrl = value ; }
2629 }
2730
28- Lazy < string > _apiKey = new ( ( ) =>
29- Environment . GetEnvironmentVariable ( "ARCADE_API_KEY" )
30- ?? throw new ArcadeInvalidDataException (
31- string . Format ( "{0} cannot be null" , nameof ( APIKey ) ) ,
32- new ArgumentNullException ( nameof ( APIKey ) )
33- )
34- ) ;
3531 public string APIKey
3632 {
37- get { return _apiKey . Value ; }
38- init { _apiKey = new ( ( ) => value ) ; }
33+ get { return this . _options . APIKey ; }
34+ init { this . _options . APIKey = value ; }
3935 }
4036
4137 readonly Lazy < IAdminService > _admin ;
Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Net . Http ;
3+ using ArcadeDotnet . Exceptions ;
4+
5+ namespace ArcadeDotnet . Core ;
6+
7+ public struct ClientOptions ( )
8+ {
9+ public HttpClient HttpClient { get ; set ; } = new ( ) ;
10+
11+ Lazy < Uri > _baseUrl = new ( ( ) =>
12+ new Uri ( Environment . GetEnvironmentVariable ( "ARCADE_BASE_URL" ) ?? "https://api.arcade.dev" )
13+ ) ;
14+ public Uri BaseUrl
15+ {
16+ readonly get { return _baseUrl . Value ; }
17+ set { _baseUrl = new ( ( ) => value ) ; }
18+ }
19+
20+ /// <summary>
21+ /// API key used for authorization in header
22+ /// </summary>
23+ Lazy < string > _apiKey = new ( ( ) =>
24+ Environment . GetEnvironmentVariable ( "ARCADE_API_KEY" )
25+ ?? throw new ArcadeInvalidDataException (
26+ string . Format ( "{0} cannot be null" , nameof ( APIKey ) ) ,
27+ new ArgumentNullException ( nameof ( APIKey ) )
28+ )
29+ ) ;
30+
31+ /// <summary>
32+ /// API key used for authorization in header
33+ /// </summary>
34+ public string APIKey
35+ {
36+ readonly get { return _apiKey . Value ; }
37+ set { _apiKey = new ( ( ) => value ) ; }
38+ }
39+ }
You can’t perform that action at this time.
0 commit comments