/// <summary>
        /// 追加Query参数到请求路径
        /// </summary>
        /// <param name="key">参数名</param>
        /// <param name="value">参数值</param>
        /// <param name="encoding">编码</param>
        /// <exception cref="ApiInvalidConfigException"></exception>
        /// <exception cref="ArgumentNullException"></exception>
        public void AddUrlQuery(string key, string?value, Encoding encoding)
        {
            if (this.RequestUri == null)
            {
                throw new ApiInvalidConfigException(Resx.required_RequestUri);
            }

            var editor = new UriEditor(this.RequestUri, encoding);

            editor.AddQuery(key, value);
            this.RequestUri = editor.Uri;
        }
Esempio n. 2
0
        /// <summary>
        /// 追加Query参数到请求路径
        /// </summary>
        /// <param name="key">参数名</param>
        /// <param name="value">参数值</param>
        /// <exception cref="ApiInvalidConfigException"></exception>
        /// <exception cref="ArgumentNullException"></exception>
        public void AddUrlQuery(string key, string?value)
        {
            if (this.RequestUri == null)
            {
                throw new ApiInvalidConfigException(Resx.required_RequestUri);
            }

            if (string.IsNullOrEmpty(key))
            {
                throw new ArgumentNullException(nameof(key));
            }

            var editor = new UriEditor(this.RequestUri);

            editor.AddQuery(key, value);
            this.RequestUri = editor.Uri;
        }
Esempio n. 3
0
        /// <summary>
        /// 追加Query参数到请求路径
        /// </summary>
        /// <param name="key">参数名</param>
        /// <param name="value">参数值</param>
        /// <param name="encoding">编码</param>
        /// <exception cref="HttpApiInvalidOperationException"></exception>
        /// <exception cref="ArgumentNullException"></exception>
        public void AddUrlQuery(string key, string value, Encoding encoding)
        {
            if (this.RequestUri == null)
            {
                throw new HttpApiInvalidOperationException(Resx.required_RequestUri);
            }

            if (string.IsNullOrEmpty(key))
            {
                throw new ArgumentNullException(nameof(key));
            }

            if (encoding == null)
            {
                throw new ArgumentNullException(nameof(encoding));
            }

            var editor = new UriEditor(this.RequestUri, encoding);

            editor.AddQuery(key, value);
            this.RequestUri = editor.Uri;
        }