コード例 #1
0
        /// <summary>
        /// 添加字段到已有的Content
        /// 要求content-type为application/x-www-form-urlencoded
        /// </summary>
        /// <param name="name">名称</param>
        /// <param name="value">值</param>
        /// <exception cref="NotSupportedException"></exception>
        /// <exception cref="ArgumentNullException"></exception>
        /// <returns></returns>
        public async Task AddFormFieldAsync(string name, string?value)
        {
            var keyValue = new KeyValue(name, value);

            await this.AddFormFieldAsync(new[] { keyValue }).ConfigureAwait(false);
        }
コード例 #2
0
        /// <summary>
        /// 添加文本内容到已有的Content
        /// 要求content-type为multipart/form-data
        /// </summary>
        /// <param name="name">名称</param>
        /// <param name="value">文本</param>
        /// <exception cref="NotSupportedException"></exception>
        /// <exception cref="ArgumentNullException"></exception>
        public void AddFormDataText(string name, string?value)
        {
            var keyValue = new KeyValue(name, value);

            this.AddFormDataText(new[] { keyValue });
        }
コード例 #3
0
 /// <summary>
 /// 追加Query参数到请求路径
 /// </summary>
 /// <param name="keyValue">参数</param>
 /// <exception cref="ApiInvalidConfigException"></exception>
 /// <exception cref="ArgumentNullException"></exception>
 public void AddUrlQuery(KeyValue keyValue)
 {
     this.AddUrlQuery(keyValue, Encoding.UTF8);
 }
コード例 #4
0
 /// <summary>
 /// 追加Query参数到请求路径
 /// </summary>
 /// <param name="keyValue">参数</param>
 /// <param name="encoding">编码</param>
 /// <exception cref="ApiInvalidConfigException"></exception>
 /// <exception cref="ArgumentNullException"></exception>
 public void AddUrlQuery(KeyValue keyValue, Encoding encoding)
 {
     this.AddUrlQuery(keyValue.Key, keyValue.Value, encoding);
 }
コード例 #5
0
 /// <summary>
 /// 文本内容
 /// </summary>
 /// <param name="keyValue">键值对</param>
 public FormDataTextContent(KeyValue keyValue)
     : this(keyValue.Key, keyValue.Value)
 {
 }