protected virtual void InitRestClients() { RestClient = new RestClient(RootUrl + "api/v1/"); RestClient.AddDefaultHeader("Authentication", ApiKey); RestClient.AddDefaultHeader("X-Api-Key", ApiKey); RestClient.UseSystemTextJson(); Blacklist = new ClientBase <BlacklistResource>(RestClient, ApiKey); Commands = new CommandClient(RestClient, ApiKey); DownloadClients = new DownloadClientClient(RestClient, ApiKey); Books = new BookClient(RestClient, ApiKey); History = new ClientBase <HistoryResource>(RestClient, ApiKey); HostConfig = new ClientBase <HostConfigResource>(RestClient, ApiKey, "config/host"); Indexers = new IndexerClient(RestClient, ApiKey); Logs = new LogsClient(RestClient, ApiKey); NamingConfig = new ClientBase <NamingConfigResource>(RestClient, ApiKey, "config/naming"); Notifications = new NotificationClient(RestClient, ApiKey); Profiles = new ClientBase <QualityProfileResource>(RestClient, ApiKey); Releases = new ReleaseClient(RestClient, ApiKey); ReleasePush = new ReleasePushClient(RestClient, ApiKey); RootFolders = new ClientBase <RootFolderResource>(RestClient, ApiKey); Author = new AuthorClient(RestClient, ApiKey); Tags = new ClientBase <TagResource>(RestClient, ApiKey); WantedMissing = new ClientBase <BookResource>(RestClient, ApiKey, "wanted/missing"); WantedCutoffUnmet = new ClientBase <BookResource>(RestClient, ApiKey, "wanted/cutoff"); }
static void Main(string[] args) { var httpClient = new HttpClient(); var client = new AuthorClient("http://localhost:56098/", httpClient); var result = client.GetAllAsync().GetAwaiter().GetResult(); Console.WriteLine(result.ToString()); Console.ReadKey(); }
public HttpClientFactoryInstanceManagementService(IHttpClientFactory httpClientFactory, AuthorClient authorClient) { _httpClientFactory = httpClientFactory; _auhtorClient = authorClient; }