Skip to content

Commit 2b471aa

Browse files
committed
feat(dynamicModel): add dynamic model and meta files
1 parent 91fa51c commit 2b471aa

File tree

69 files changed

+965
-84
lines changed

Some content is hidden

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

69 files changed

+965
-84
lines changed

Authentication.meta

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Authentication/Authenticator.cs.meta

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Authentication/BasicAuthenticator.cs.meta

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Authentication/BearerTokenAuthenticator.cs.meta

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Authentication/CloudPakForData.meta

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Authentication/CloudPakForData/CloudPakForDataAuthenticator.cs.meta

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Authentication/CloudPakForData/CloudPakForDataToken.cs.meta

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Authentication/CloudPakForData/CloudPakForDataTokenResponse.cs.meta

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Authentication/ConfigBasedAuthenticatorFactory.cs

-4
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,6 @@ private static Authenticator CreateAuthenticator(Dictionary<string, string> prop
100100
{
101101
authenticator = new BearerTokenAuthenticator(props);
102102
}
103-
else
104-
{
105-
throw new ArgumentException(string.Format(ErrorMessageAuthTypeUnknown, authType));
106-
}
107103

108104
return authenticator;
109105
}

Authentication/ConfigBasedAuthenticatorFactory.cs.meta

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Authentication/Iam.meta

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Authentication/Iam/IamAuthenticator.cs.meta

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Authentication/Iam/IamToken.cs.meta

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Authentication/Iam/IamTokenResponse.cs.meta

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Authentication/NoAuthAuthenticator.cs.meta

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Model.meta

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Model/DynamicModel.cs

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
/**
2+
* Copyright 2019 IBM Corp. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
using Newtonsoft.Json;
19+
using Newtonsoft.Json.Linq;
20+
using System.Collections.Generic;
21+
22+
namespace IBM.Cloud.SDK.Model
23+
{
24+
/// <summary>
25+
/// This class is the base class for generated models with restricted additional properties.
26+
/// </summary>
27+
/// <typeparam name="T"></typeparam>
28+
public class DynamicModel<T>
29+
{
30+
/// <summary>
31+
/// A Dictionary to keep restricted additional properties.
32+
/// </summary>
33+
[JsonExtensionData]
34+
public Dictionary<string, JToken> AdditionalProperties { get; } = new Dictionary<string, JToken>();
35+
36+
/// <summary>
37+
/// Add a property to the AdditionalProperties dictionary.
38+
/// </summary>
39+
/// <param name="key"></param>
40+
/// <param name="value"></param>
41+
public void Add(string key, T value)
42+
{
43+
AdditionalProperties.Add(key, JToken.FromObject(value));
44+
}
45+
46+
/// <summary>
47+
/// Remove a property from the AdditionalProperties dictionary.
48+
/// </summary>
49+
/// <param name="key"></param>
50+
public void Remove(string key)
51+
{
52+
AdditionalProperties.Remove(key);
53+
}
54+
55+
/// <summary>
56+
/// Get a single property from the AdditionalProperties dictionary.
57+
/// </summary>
58+
/// <param name="key"></param>
59+
/// <returns></returns>
60+
public T Get(string key)
61+
{
62+
AdditionalProperties.TryGetValue(key, out JToken value);
63+
return value.ToObject<T>();
64+
}
65+
}
66+
67+
/// <summary>
68+
/// This class is the base class for generated models with arbitrary additional properties.
69+
/// </summary>
70+
public class DynamicModel
71+
{
72+
/// <summary>
73+
/// A Dictionary to keep arbitrary additional properties.
74+
/// </summary>
75+
[JsonExtensionData]
76+
public Dictionary<string, JToken> AdditionalProperties { get; } = new Dictionary<string, JToken>();
77+
78+
/// <summary>
79+
/// Add a property to the AdditionalProperties dictionary.
80+
/// </summary>
81+
/// <param name="key"></param>
82+
/// <param name="value"></param>
83+
public void Add(string key, object value)
84+
{
85+
AdditionalProperties.Add(key, JToken.FromObject(value));
86+
}
87+
88+
/// <summary>
89+
/// Remove a property from the AdditionalProperties dictionary.
90+
/// </summary>
91+
/// <param name="key"></param>
92+
public void Remove(string key)
93+
{
94+
AdditionalProperties.Remove(key);
95+
}
96+
97+
/// <summary>
98+
/// Get a single property from the AdditionalProperties dictionary.
99+
/// </summary>
100+
/// <param name="key"></param>
101+
/// <returns></returns>
102+
public JToken Get(string key)
103+
{
104+
AdditionalProperties.TryGetValue(key, out JToken value);
105+
return value;
106+
}
107+
}
108+
}

Model/DynamicModel.cs.meta

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Plugins/websocket-sharp.dll.meta

+4-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)