예제 #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);