Skip to content

Commit

Permalink
style: fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
nattb8 committed Oct 14, 2024
1 parent f8668b9 commit 9ab6470
Show file tree
Hide file tree
Showing 30 changed files with 132 additions and 124 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public ActivitiesApi(string basePath)
new Immutable.Api.Client.Configuration { BasePath = basePath }
);
this.ApiClient = new Immutable.Api.Client.ApiClient(this.Configuration.BasePath);
this.Client = this.ApiClient;
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
this.ExceptionFactory = Immutable.Api.Client.Configuration.DefaultExceptionFactory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public ChainsApi(string basePath)
new Immutable.Api.Client.Configuration { BasePath = basePath }
);
this.ApiClient = new Immutable.Api.Client.ApiClient(this.Configuration.BasePath);
this.Client = this.ApiClient;
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
this.ExceptionFactory = Immutable.Api.Client.Configuration.DefaultExceptionFactory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ public CollectionsApi(string basePath)
new Immutable.Api.Client.Configuration { BasePath = basePath }
);
this.ApiClient = new Immutable.Api.Client.ApiClient(this.Configuration.BasePath);
this.Client = this.ApiClient;
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
this.ExceptionFactory = Immutable.Api.Client.Configuration.DefaultExceptionFactory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public CraftingApi(string basePath)
new Immutable.Api.Client.Configuration { BasePath = basePath }
);
this.ApiClient = new Immutable.Api.Client.ApiClient(this.Configuration.BasePath);
this.Client = this.ApiClient;
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
this.ExceptionFactory = Immutable.Api.Client.Configuration.DefaultExceptionFactory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ public MetadataApi(string basePath)
new Immutable.Api.Client.Configuration { BasePath = basePath }
);
this.ApiClient = new Immutable.Api.Client.ApiClient(this.Configuration.BasePath);
this.Client = this.ApiClient;
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
this.ExceptionFactory = Immutable.Api.Client.Configuration.DefaultExceptionFactory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ public NftOwnersApi(string basePath)
new Immutable.Api.Client.Configuration { BasePath = basePath }
);
this.ApiClient = new Immutable.Api.Client.ApiClient(this.Configuration.BasePath);
this.Client = this.ApiClient;
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
this.ExceptionFactory = Immutable.Api.Client.Configuration.DefaultExceptionFactory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ public NftsApi(string basePath)
new Immutable.Api.Client.Configuration { BasePath = basePath }
);
this.ApiClient = new Immutable.Api.Client.ApiClient(this.Configuration.BasePath);
this.Client = this.ApiClient;
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
this.ExceptionFactory = Immutable.Api.Client.Configuration.DefaultExceptionFactory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ public OrdersApi(string basePath)
new Immutable.Api.Client.Configuration { BasePath = basePath }
);
this.ApiClient = new Immutable.Api.Client.ApiClient(this.Configuration.BasePath);
this.Client = this.ApiClient;
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
this.ExceptionFactory = Immutable.Api.Client.Configuration.DefaultExceptionFactory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public PassportApi(string basePath)
new Immutable.Api.Client.Configuration { BasePath = basePath }
);
this.ApiClient = new Immutable.Api.Client.ApiClient(this.Configuration.BasePath);
this.Client = this.ApiClient;
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
this.ExceptionFactory = Immutable.Api.Client.Configuration.DefaultExceptionFactory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public PassportProfileApi(string basePath)
new Immutable.Api.Client.Configuration { BasePath = basePath }
);
this.ApiClient = new Immutable.Api.Client.ApiClient(this.Configuration.BasePath);
this.Client = this.ApiClient;
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
this.ExceptionFactory = Immutable.Api.Client.Configuration.DefaultExceptionFactory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public PricingApi(string basePath)
new Immutable.Api.Client.Configuration { BasePath = basePath }
);
this.ApiClient = new Immutable.Api.Client.ApiClient(this.Configuration.BasePath);
this.Client = this.ApiClient;
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
this.ExceptionFactory = Immutable.Api.Client.Configuration.DefaultExceptionFactory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public StacksApi(string basePath)
new Immutable.Api.Client.Configuration { BasePath = basePath }
);
this.ApiClient = new Immutable.Api.Client.ApiClient(this.Configuration.BasePath);
this.Client = this.ApiClient;
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
this.ExceptionFactory = Immutable.Api.Client.Configuration.DefaultExceptionFactory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public TokensApi(string basePath)
new Immutable.Api.Client.Configuration { BasePath = basePath }
);
this.ApiClient = new Immutable.Api.Client.ApiClient(this.Configuration.BasePath);
this.Client = this.ApiClient;
this.Client = this.ApiClient;
this.AsynchronousClient = this.ApiClient;
this.ExceptionFactory = Immutable.Api.Client.Configuration.DefaultExceptionFactory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public string Serialize(object obj)

public T Deserialize<T>(UnityWebRequest request)
{
var result = (T) Deserialize(request, typeof(T));
var result = (T)Deserialize(request, typeof(T));
return result;
}

Expand Down Expand Up @@ -148,7 +148,7 @@ internal object Deserialize(UnityWebRequest request, Type type)
throw new ApiException((int)request.responseCode, request.error, text);
}
}

if (type != typeof(global::System.Object) && request.responseCode >= 200 && request.responseCode < 300)
{
throw new UnexpectedResponseException(request, type);
Expand Down Expand Up @@ -333,16 +333,16 @@ private UnityWebRequest NewRequest<T>(

if (options.Cookies != null && options.Cookies.Count > 0)
{
#if UNITY_WEBGL
#if UNITY_WEBGL
throw new System.InvalidOperationException("UnityWebRequest does not support setting cookies in WebGL");
#else
#else
if (options.Cookies.Count != 1)
{
UnityEngine.Debug.LogError("Only one cookie supported, ignoring others");
}

request.SetRequestHeader("Cookie", options.Cookies[0].ToString());
#endif
#endif
}

return request;
Expand All @@ -354,7 +354,7 @@ private UnityWebRequest NewRequest<T>(

private ApiResponse<T> ToApiResponse<T>(UnityWebRequest request, object responseData)
{
T result = (T) responseData;
T result = (T)responseData;

var transformed = new ApiResponse<T>((HttpStatusCode)request.responseCode, new Multimap<string, string>(), result, request.downloadHandler?.text ?? "")
{
Expand Down Expand Up @@ -418,7 +418,7 @@ private async Task<ApiResponse<T>> ExecAsync<T>(
{
await tsc.Task;
}

if (request.result == UnityWebRequest.Result.ConnectionError ||
request.result == UnityWebRequest.Result.DataProcessingError)
{
Expand All @@ -430,11 +430,11 @@ private async Task<ApiResponse<T>> ExecAsync<T>(
// if the response type is oneOf/anyOf, call FromJSON to deserialize the data
if (typeof(Immutable.Api.Model.AbstractOpenAPISchema).IsAssignableFrom(typeof(T)))
{
responseData = (T) typeof(T).GetMethod("FromJson").Invoke(null, new object[] { new ByteArrayContent(request.downloadHandler.data) });
responseData = (T)typeof(T).GetMethod("FromJson").Invoke(null, new object[] { new ByteArrayContent(request.downloadHandler.data) });
}
else if (typeof(T).Name == "Stream") // for binary response
{
responseData = (T) (object) new MemoryStream(request.downloadHandler.data);
responseData = (T)(object)new MemoryStream(request.downloadHandler.data);
}

InterceptResponse(request, path, options, configuration, ref responseData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,15 @@ public static Multimap<string, string> ParameterToMultiMap(string collectionForm
}
else if (value is IDictionary dictionary)
{
if(collectionFormat == "deepObject") {
if (collectionFormat == "deepObject")
{
foreach (DictionaryEntry entry in dictionary)
{
parameters.Add(name + "[" + entry.Key + "]", ParameterToString(entry.Value));
}
}
else {
else
{
foreach (DictionaryEntry entry in dictionary)
{
parameters.Add(entry.Key.ToString(), ParameterToString(entry.Value));
Expand Down Expand Up @@ -103,7 +105,8 @@ public static string ParameterToString(object obj, IReadableConfiguration config
return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat);
if (obj is bool boolean)
return boolean ? "true" : "false";
if (obj is ICollection collection) {
if (obj is ICollection collection)
{
List<string> entries = new List<string>();
foreach (var entry in collection)
entries.Add(ParameterToString(entry, configuration));
Expand Down Expand Up @@ -223,7 +226,7 @@ private static bool HasEnumMemberAttrValue(object enumVal)
var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException());
var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType<EnumMemberAttribute>().FirstOrDefault();
if (attr != null) return true;
return false;
return false;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public Configuration(
/// <summary>
/// Gets or sets the base path for API access.
/// </summary>
public virtual string BasePath
public virtual string BasePath
{
get { return _basePath; }
set { _basePath = value; }
Expand Down Expand Up @@ -522,7 +522,7 @@ private string GetServerUrl(IList<IReadOnlyDictionary<string, object>> servers,

return url;
}

/// <summary>
/// Gets and Sets the RemoteCertificateValidationCallback
/// </summary>
Expand All @@ -539,7 +539,7 @@ public static string ToDebugReport()
{
string report = "C# SDK (Immutable.Api) Debug Report:\n";
report += " OS: " + System.Environment.OSVersion + "\n";
report += " .NET Framework Version: " + System.Environment.Version + "\n";
report += " .NET Framework Version: " + System.Environment.Version + "\n";
report += " Version of the API: 1.0.0\n";
report += " SDK Package Version: 1.0.0\n";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,37 +18,37 @@ namespace Immutable.Api.Client
/// </summary>
class WebRequestPathBuilder
{
private string _baseUrl;
private string _path;
private string _query = "?";
public WebRequestPathBuilder(string baseUrl, string path)
{
_baseUrl = baseUrl;
_path = path;
}
private string _baseUrl;
private string _path;
private string _query = "?";
public WebRequestPathBuilder(string baseUrl, string path)
{
_baseUrl = baseUrl;
_path = path;
}

public void AddPathParameters(Dictionary<string, string> parameters)
public void AddPathParameters(Dictionary<string, string> parameters)
{
foreach (var parameter in parameters)
{
foreach (var parameter in parameters)
{
_path = _path.Replace("{" + parameter.Key + "}", Uri.EscapeDataString(parameter.Value));
}
_path = _path.Replace("{" + parameter.Key + "}", Uri.EscapeDataString(parameter.Value));
}
}

public void AddQueryParameters(Multimap<string, string> parameters)
public void AddQueryParameters(Multimap<string, string> parameters)
{
foreach (var parameter in parameters)
{
foreach (var parameter in parameters)
foreach (var value in parameter.Value)
{
foreach (var value in parameter.Value)
{
_query = _query + parameter.Key + "=" + Uri.EscapeDataString(value) + "&";
}
_query = _query + parameter.Key + "=" + Uri.EscapeDataString(value) + "&";
}
}
}

public string GetFullUri()
{
return _baseUrl + _path + _query.Substring(0, _query.Length - 1);
}
public string GetFullUri()
{
return _baseUrl + _path + _query.Substring(0, _query.Length - 1);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public partial class ActivityAsset : AbstractOpenAPISchema
public ActivityAsset(ActivityNFT actualInstance)
{
this.IsNullable = false;
this.SchemaType= "oneOf";
this.SchemaType = "oneOf";
this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null.");
}

Expand All @@ -53,7 +53,7 @@ public ActivityAsset(ActivityNFT actualInstance)
public ActivityAsset(ActivityToken actualInstance)
{
this.IsNullable = false;
this.SchemaType= "oneOf";
this.SchemaType = "oneOf";
this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null.");
}

Expand Down Expand Up @@ -225,7 +225,7 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s
/// <returns>The object converted from the JSON string</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
switch(reader.TokenType)
switch (reader.TokenType)
{
case JsonToken.StartObject:
return ActivityAsset.FromJson(JObject.Load(reader).ToString(Formatting.None));
Expand Down
Loading

0 comments on commit 9ab6470

Please sign in to comment.