示例#1
0
        public void AddField <T>(string name, T value, MimeType mediaType)
        {
            name.AssertNotNull(nameof(name));
            mediaType.AssertNotNull(nameof(mediaType));

            _fields.Insert(0, new RequestFormField(name, RestValue.Create(value), mediaType));
        }
示例#2
0
        public RequestQuery(string name, RestValue content)
        {
            name.AssertNotNullOrEmpty(nameof(name));

            Name    = name;
            Content = content;
        }
        public RequestRouteSegment(string name, RestValue content)
        {
            name.AssertNotNullOrEmpty(nameof(name));
            content.AssertNotNull(nameof(content));

            Name    = name;
            Content = content;
        }
示例#4
0
        public RestClientBuilder WithDefaultRequestSegment <T>(string name, T value)
        {
            name.AssertNotNullOrEmpty(nameof(name));

            var segment = new RequestRouteSegment(name, RestValue.Create(value));

            _container.Register(new RequestEnricher(x => x.AddRouteSegment(segment)));

            return(this);
        }
示例#5
0
        public RestClientBuilder WithDefaultRequestQuery <T>(string name, T value)
        {
            name.AssertNotNullOrEmpty(nameof(name));

            var query = new RequestQuery(name, RestValue.Create(value));

            _container.Register(new RequestEnricher(x => x.AddQuery(query)));

            return(this);
        }
示例#6
0
        public void AddQuery <T>(string name, T value)
        {
            name.AssertNotNullOrEmpty(nameof(name));

            AddQuery(new RequestQuery(name, RestValue.Create(value)));
        }
示例#7
0
        public void AddRouteSegment <T>(string name, T value)
        {
            name.AssertNotNullOrEmpty(nameof(name));

            AddRouteSegment(new RequestRouteSegment(name, RestValue.Create(value)));
        }
示例#8
0
 public override bool CanSerialize(RestValue value)
 => value.Type == typeof(TValue);
示例#9
0
 public override string Serialize(RestValue value, CultureInfo cultureInfo)
 => _formatter((TValue)value.Value);