Exemplo n.º 1
0
 public static IScaniiClient CreateDefault(string authToken, ILogger logger = null,
                                           HttpClient client = null, ScaniiTarget target = null)
 {
     logger ??= NullLogger.Instance;
     client ??= new HttpClient();
     target ??= ScaniiTarget.Auto;
     return(new DefaultScaniiClient(target, authToken, "", logger, client));
 }
Exemplo n.º 2
0
        private void Initialize(ScaniiTarget target, string key, string secret)
        {
            _version = Assembly.GetExecutingAssembly().GetName().Version;

            RestClient = new RestClient(Endpoints.Resolve(target))
            {
                Authenticator = new HttpBasicAuthenticator(key, secret),
                UserAgent     = HttpHeaders.Ua + "/v" + _version
            };

            Log.Logger.Information("starting client with version {version} and target {target}", _version, target);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Creates a new Scanii Client from a authentication token
 /// </summary>
 /// <param name="target">the API version and location target @see ScaniiTarget</param>
 /// <param name="token">your authentication token</param>
 public ScaniiClient(ScaniiTarget target, string token)
 {
     Initialize(target, token, null);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Creates a new Scanii Client from a key/scret pair
 /// </summary>
 /// <param name="target">the API target to use @see ScaniiTarget</param>
 /// <param name="key">the key to use</param>
 /// <param name="secret">the secret to use</param>
 public ScaniiClient(ScaniiTarget target, string key, string secret)
 {
     Initialize(target, key, secret);
 }