Skip to content

Commit 5cd8bfd

Browse files
release 3.0.17-beta source code for net
1 parent 3426731 commit 5cd8bfd

File tree

392 files changed

+12999
-2695
lines changed

Some content is hidden

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

392 files changed

+12999
-2695
lines changed

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
## 3.0.17-beta 2020-10-14
2+
## HuaweiCloud SDK Bss
3+
- ### Features
4+
- Partner center supports exporting product catalog prices.
5+
- ### Bug Fix
6+
- None
7+
- ### Change
8+
- None
9+
10+
## HuaweiCloud SDK Dcs
11+
- ### Features
12+
- Support more interfaces.
13+
- ### Bug Fix
14+
- None
15+
- ### Change
16+
- None
17+
18+
119
## 3.0.16-beta 2020-10-12
220
## HuaweiCloud SDK CTS
321
- ### Features

CHANGELOG_CN.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
## 3.0.17-beta 2020-10-14
2+
## HuaweiCloud SDK Bss
3+
- ### 新增特性
4+
- 伙伴中心支持导出产品目录价
5+
- ### 解决问题
6+
-
7+
- ### 特性变更
8+
-
9+
10+
## HuaweiCloud SDK Dcs
11+
- ### 新增特性
12+
- 增加支持接口
13+
- ### 解决问题
14+
-
15+
- ### 特性变更
16+
-
17+
18+
119
## 3.0.16-beta 2020-10-12
220
## HuaweiCloud SDK CTS
321
- ### 新增特性

Core/Utils/JsonUtils.cs

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
using System;
2323
using System.Collections.Generic;
24+
using System.Linq;
2425
using System.Net.Http;
2526
using System.Reflection;
2627
using Newtonsoft.Json;
@@ -38,19 +39,55 @@ public static T DeSerialize<T>(HttpResponseMessage message)
3839
}
3940

4041
var body = message.Content.ReadAsStringAsync().Result;
42+
var jsonObject = SetResponseBody<T>(body);
43+
44+
SetAdditionalAttrs(message, jsonObject, body);
45+
SetResponseHeaders(message, jsonObject);
46+
47+
return jsonObject;
48+
}
49+
50+
private static T SetResponseBody<T>(string body)
51+
{
4152
var jsonObject = JsonConvert.DeserializeObject<T>(body, GetJsonSettings());
53+
4254
if (jsonObject == null)
4355
{
4456
jsonObject = Activator.CreateInstance<T>();
4557
}
4658

59+
return jsonObject;
60+
}
61+
62+
private static void SetResponseHeaders<T>(HttpResponseMessage message, T jsonObject)
63+
{
64+
const BindingFlags instanceBindFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
65+
66+
var properties = jsonObject.GetType().GetProperties(instanceBindFlags);
67+
foreach (var property in properties)
68+
{
69+
var oriAttrName = "";
70+
var customAttrs = property.GetCustomAttributes(typeof(JsonPropertyAttribute), true);
71+
if (customAttrs.Length > 0)
72+
{
73+
oriAttrName = (string) customAttrs[0].GetType().GetProperty("PropertyName")?.GetValue(
74+
property.GetCustomAttributes(typeof(JsonPropertyAttribute), true)[0]);
75+
}
76+
77+
if (!string.IsNullOrEmpty(oriAttrName) && message.Headers.Contains(oriAttrName))
78+
{
79+
property.SetValue(jsonObject, message.Headers.GetValues(oriAttrName).First());
80+
}
81+
}
82+
}
83+
84+
private static void SetAdditionalAttrs<T>(HttpResponseMessage message, T jsonObject, string body)
85+
{
4786
jsonObject.GetType().GetProperty("HttpStatusCode")?.SetValue(jsonObject, (int) message.StatusCode, null);
4887
jsonObject.GetType().GetProperty("HttpHeaders")?.SetValue(jsonObject, message.Headers.ToString(), null);
4988
jsonObject.GetType().GetProperty("HttpBody")?.SetValue(jsonObject, body, null);
50-
51-
return jsonObject;
5289
}
53-
90+
5491
private static T DeSerializeStream<T>(HttpResponseMessage message)
5592
{
5693
var t = Activator.CreateInstance<T>();
@@ -65,7 +102,8 @@ private static T DeSerializeStream<T>(HttpResponseMessage message)
65102

66103
public static T DeSerialize<T>(SdkResponse response) where T : SdkResponse
67104
{
68-
var jsonObject = JsonConvert.DeserializeObject<T>(response.HttpBody, GetJsonSettings()) ?? Activator.CreateInstance<T>();
105+
var jsonObject = JsonConvert.DeserializeObject<T>(response.HttpBody, GetJsonSettings()) ??
106+
Activator.CreateInstance<T>();
69107

70108
jsonObject.HttpStatusCode = response.HttpStatusCode;
71109
jsonObject.HttpHeaders = response.HttpHeaders;
@@ -98,7 +136,7 @@ public static string Serialize(object item)
98136
{
99137
return JsonConvert.SerializeObject(item);
100138
}
101-
139+
102140
private static JsonSerializerSettings GetJsonSettings()
103141
{
104142
var settings = new JsonSerializerSettings

Core/obj/Core.csproj.nuget.cache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"version": 1,
3-
"dgSpecHash": "JEn9JsKK1RSBPW5L91tImKlfnhElDU+oPIH4mGpq4cHlbKBzRsUv0ek33WFPIAMla/mX3djbvSjvvgX0GxFdeA==",
3+
"dgSpecHash": "/FP7Vh2ZG1DsJwjHu58wG5wtmSav9xdoW7hPqALc2n7dR1G1AbJ9ilB5JZWPscci8mPEPnqSzfdv0kYwfnZiRQ==",
44
"success": true
55
}

Core/obj/Core.csproj.nuget.dgspec.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
22
"format": 1,
33
"restore": {
4-
"/data/fuxi_ci_workspace/5f84461198000732b8ea9d0a/Core/Core.csproj": {}
4+
"/data/fuxi_ci_workspace/5f86c34fc2dc623563da18f5/Core/Core.csproj": {}
55
},
66
"projects": {
7-
"/data/fuxi_ci_workspace/5f84461198000732b8ea9d0a/Core/Core.csproj": {
7+
"/data/fuxi_ci_workspace/5f86c34fc2dc623563da18f5/Core/Core.csproj": {
88
"version": "1.0.0",
99
"restore": {
10-
"projectUniqueName": "/data/fuxi_ci_workspace/5f84461198000732b8ea9d0a/Core/Core.csproj",
10+
"projectUniqueName": "/data/fuxi_ci_workspace/5f86c34fc2dc623563da18f5/Core/Core.csproj",
1111
"projectName": "HuaweiCloud.SDK.Core",
12-
"projectPath": "/data/fuxi_ci_workspace/5f84461198000732b8ea9d0a/Core/Core.csproj",
12+
"projectPath": "/data/fuxi_ci_workspace/5f86c34fc2dc623563da18f5/Core/Core.csproj",
1313
"packagesPath": "/root/.nuget/packages/",
14-
"outputPath": "/data/fuxi_ci_workspace/5f84461198000732b8ea9d0a/Core/obj/",
14+
"outputPath": "/data/fuxi_ci_workspace/5f86c34fc2dc623563da18f5/Core/obj/",
1515
"projectStyle": "PackageReference",
1616
"fallbackFolders": [
1717
"/usr/dotnet/sdk/NuGetFallbackFolder"
@@ -23,7 +23,7 @@
2323
"netstandard2.0"
2424
],
2525
"sources": {
26-
"/data/fuxi_ci_workspace/5f84461198000732b8ea9d0a/package": {}
26+
"/data/fuxi_ci_workspace/5f86c34fc2dc623563da18f5/package": {}
2727
},
2828
"frameworks": {
2929
"netstandard2.0": {

Core/obj/Core.csproj.nuget.g.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
44
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
55
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
6-
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">/data/fuxi_ci_workspace/5f84461198000732b8ea9d0a/Core/obj/project.assets.json</ProjectAssetsFile>
6+
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">/data/fuxi_ci_workspace/5f86c34fc2dc623563da18f5/Core/obj/project.assets.json</ProjectAssetsFile>
77
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/root/.nuget/packages/</NuGetPackageRoot>
88
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/root/.nuget/packages/;/usr/dotnet/sdk/NuGetFallbackFolder</NuGetPackageFolders>
99
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>

Core/obj/project.assets.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3593,11 +3593,11 @@
35933593
"project": {
35943594
"version": "1.0.0",
35953595
"restore": {
3596-
"projectUniqueName": "/data/fuxi_ci_workspace/5f84461198000732b8ea9d0a/Core/Core.csproj",
3596+
"projectUniqueName": "/data/fuxi_ci_workspace/5f86c34fc2dc623563da18f5/Core/Core.csproj",
35973597
"projectName": "HuaweiCloud.SDK.Core",
3598-
"projectPath": "/data/fuxi_ci_workspace/5f84461198000732b8ea9d0a/Core/Core.csproj",
3598+
"projectPath": "/data/fuxi_ci_workspace/5f86c34fc2dc623563da18f5/Core/Core.csproj",
35993599
"packagesPath": "/root/.nuget/packages/",
3600-
"outputPath": "/data/fuxi_ci_workspace/5f84461198000732b8ea9d0a/Core/obj/",
3600+
"outputPath": "/data/fuxi_ci_workspace/5f86c34fc2dc623563da18f5/Core/obj/",
36013601
"projectStyle": "PackageReference",
36023602
"fallbackFolders": [
36033603
"/usr/dotnet/sdk/NuGetFallbackFolder"
@@ -3609,7 +3609,7 @@
36093609
"netstandard2.0"
36103610
],
36113611
"sources": {
3612-
"/data/fuxi_ci_workspace/5f84461198000732b8ea9d0a/package": {}
3612+
"/data/fuxi_ci_workspace/5f86c34fc2dc623563da18f5/package": {}
36133613
},
36143614
"frameworks": {
36153615
"netstandard2.0": {

0 commit comments

Comments
 (0)