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)); }
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); }
/// <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); }
/// <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); }