Пример #1
0
        public BranchClient(BranchConfig config)
        {
            var httpOptions = new HttpOptions();

            httpOptions.Headers.Add("Authorization", $"bearer {config.Key}");

            Client = new JsonClient(config.Url, httpOptions);
        }
Пример #2
0
        public BranchClient(IOptionsMonitor <BranchConfig> options, string name)
        {
            var opts        = options.Get(name);
            var httpOptions = new HttpOptions();

            httpOptions.Headers.Add("Authorization", $"bearer {opts.Key}");

            Client = new JsonClient(opts.Url, httpOptions);
        }
Пример #3
0
 public async Task <TRes> Do <TReq, TRes>(string path, TReq body, HttpOptions options = null)
     where TReq : class
     where TRes : class
 {
     return(await Client.Do <TReq, TRes>("POST", path, null, body, options));
 }
Пример #4
0
 public async Task <TRes> Do <TRes>(string path, HttpOptions options = null)
     where TRes : class
 {
     return(await Do <object, TRes>(path, null, options));
 }