示例#1
0
        /// <summary> Sets up the base booru api.</summary>
        /// <param name="baseUrl"> The base url used for the requests.</param>
        /// <param name="imageLimit"> The limit of images that can be fetched by a query.</param>
        /// <param name="flags"> The specifications of this api.</param>
        /// <param name="formatter"> The formatter used for formatting booru data.</param>
        /// <param name="client"> The client responsible for sending HTTP messages.</param>
        /// <param name="logger"> The logger responsible for logging notable api events.</param>
        public BooruBase(string baseUrl, int imageLimit, BooruFlags flags, IBooruFormatter formatter, HttpClient client, IBooruLogger logger)
        {
            BaseUrl = new UriBuilder(baseUrl)
            {
                Scheme = flags.HasFlag(BooruFlags.HasSSL) ? Uri.UriSchemeHttps : Uri.UriSchemeHttp
            }.Uri;

            ImageLimit = imageLimit;
            Logger     = logger;
            Flags      = flags;
            Formatter  = formatter ?? throw new ArgumentNullException(nameof(formatter));
            Client     = client;
        }
示例#2
0
 /// <summary> Sets up the advanced booru api.</summary>
 /// <param name="baseUrl"> The base url used for the requests.</param>
 /// <param name="imageLimit"> The limit of images that can be fetched by a query.</param>
 /// <param name="flags"> The specifications of this api.</param>
 /// <param name="formatter"> The formatter used for formatting booru data.</param>
 /// <param name="client"> The client responsible for sending HTTP messages.</param>
 /// <param name="logger"> The logger responsible for logging notable api events.</param>
 /// <param name="container"> The cookie container used for fetching the booru specific cookies.</param>
 public AdvancedBooruBase(string baseUrl, int imageLimit, BooruFlags flags, IBooruFormatter formatter, HttpClient client, CookieContainer container, IBooruLogger logger) :
     base(baseUrl, imageLimit, flags, formatter, client, logger)
 {
     _cookieContainer = container;
 }