Skip to content

Commit 470f318

Browse files
committed
Merge remote-tracking branch 'origin/dev' into dev
2 parents 2b3fc02 + 5830af4 commit 470f318

File tree

81 files changed

+897
-252
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+897
-252
lines changed

RestSharp.sln.DotSettings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,5 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9898
See the License for the specific language governing permissions and
9999
limitations under the License.
100100
</s:String>
101+
<s:Boolean x:Key="/Default/UserDictionary/Words/=Zimarev/@EntryIndexedValue">True</s:Boolean>
101102
</wpf:ResourceDictionary>

src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<Using Include="JetBrains.Annotations"/>
3232
</ItemGroup>
3333
<ItemGroup Condition="$(TargetFramework) == 'netstandard2.0'">
34-
<PackageReference Include="IsExternalInit" Version="1.0.1" PrivateAssets="All"/>
34+
<PackageReference Include="IsExternalInit" Version="1.0.2" PrivateAssets="All"/>
3535
</ItemGroup>
3636
<Target Name="CustomVersion" AfterTargets="MinVer">
3737
<PropertyGroup>

src/RestSharp.Serializers.NewtonsoftJson/JsonNetSerializer.cs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
1+
// Copyright © 2009-2021 John Sheehan, Andrew Young, Alexey Zimarev and RestSharp community
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
115
using Newtonsoft.Json.Serialization;
216

3-
namespace RestSharp.Serializers.NewtonsoftJson;
17+
namespace RestSharp.Serializers.NewtonsoftJson;
418

5-
public class JsonNetSerializer : IRestSerializer {
19+
public class JsonNetSerializer : IRestSerializer, ISerializer, IDeserializer {
620
/// <summary>
721
/// Default serialization settings:
822
/// - Camel-case contract resolver
@@ -37,7 +51,7 @@ public class JsonNetSerializer : IRestSerializer {
3751

3852
public string? Serialize(object? obj) {
3953
if (obj == null) return null;
40-
54+
4155
using var writerBuffer = _writerBuffer ??= new WriterBuffer(_serializer);
4256

4357
_serializer.Serialize(writerBuffer.GetJsonTextWriter(), obj, obj.GetType());
@@ -50,11 +64,15 @@ public class JsonNetSerializer : IRestSerializer {
5064
public T? Deserialize<T>(RestResponse response) {
5165
if (response.Content == null)
5266
throw new DeserializationException(response, new InvalidOperationException("Response content is null"));
67+
5368
using var reader = new JsonTextReader(new StringReader(response.Content)) { CloseInput = true };
5469

5570
return _serializer.Deserialize<T>(reader);
5671
}
5772

73+
public ISerializer Serializer => this;
74+
public IDeserializer Deserializer => this;
75+
5876
public string[] SupportedContentTypes { get; } = {
5977
"application/json", "text/json", "text/x-json", "text/javascript", "*+json"
6078
};

src/RestSharp.Serializers.NewtonsoftJson/RestClientExtensions.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
// Copyright © 2009-2021 John Sheehan, Andrew Young, Alexey Zimarev and RestSharp community
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
115
namespace RestSharp.Serializers.NewtonsoftJson;
216

317
[PublicAPI]

src/RestSharp.Serializers.NewtonsoftJson/WriterBuffer.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
// Copyright © 2009-2021 John Sheehan, Andrew Young, Alexey Zimarev and RestSharp community
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
115
using System.Globalization;
216
using System.Text;
317

src/RestSharp.Serializers.Xml/DeserializeAsAttribute.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
// ReSharper disable once CheckNamespace
1+
// Copyright © 2009-2021 John Sheehan, Andrew Young, Alexey Zimarev and RestSharp community
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// ReSharper disable once CheckNamespace
216
namespace RestSharp.Serializers;
317

418
/// <summary>

src/RestSharp.Serializers.Xml/SerializeAsAttribute.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
using System.Globalization;
1+
// Copyright © 2009-2021 John Sheehan, Andrew Young, Alexey Zimarev and RestSharp community
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
using System.Globalization;
216
using RestSharp.Extensions;
317

418
// ReSharper disable once CheckNamespace

src/RestSharp.Serializers.Xml/XmlAttributeDeserializer.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
using System.Reflection;
1+
// Copyright © 2009-2021 John Sheehan, Andrew Young, Alexey Zimarev and RestSharp community
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
using System.Reflection;
216
using System.Xml.Linq;
317
using RestSharp.Extensions;
418

src/RestSharp.Serializers.Xml/XmlDeserializer.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
// Copyright © 2009-2021 John Sheehan, Andrew Young, Alexey Zimarev and RestSharp community
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
115
using System.Collections;
216
using System.ComponentModel;
317
using System.Globalization;
@@ -8,7 +22,7 @@
822

923
namespace RestSharp.Serializers.Xml;
1024

11-
public class XmlDeserializer : IXmlDeserializer {
25+
public class XmlDeserializer : IXmlDeserializer, IWithRootElement, IWithDateFormat {
1226
public XmlDeserializer() => Culture = CultureInfo.InvariantCulture;
1327

1428
public CultureInfo Culture { get; set; }

src/RestSharp.Serializers.Xml/XmlExtensions.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
using System.Xml.Linq;
1+
// Copyright © 2009-2021 John Sheehan, Andrew Young, Alexey Zimarev and RestSharp community
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
using System.Xml.Linq;
216
using RestSharp.Extensions;
317

418
namespace RestSharp.Serializers.Xml;

0 commit comments

Comments
 (0)