Skip to content
This repository was archived by the owner on Jul 27, 2021. It is now read-only.

Minor formatting cleanup, base class implementation, some minor refactoring and upgrade to .NET 4.62. #4

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ publish/

# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
#packages/
packages/

# Windows Azure Build Output
csx
Expand Down
3 changes: 3 additions & 0 deletions .vs/ProjectSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"CurrentProjectSetting": null
}
8 changes: 8 additions & 0 deletions .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"ExpandedNodes": [
"",
"\\IotaCSharpApi"
],
"SelectedNode": "\\IotaApi.sln",
"PreviewInSolutionExplorer": false
}
1,031 changes: 1,031 additions & 0 deletions .vs/config/applicationhost.config

Large diffs are not rendered by default.

Binary file added .vs/slnx.sqlite
Binary file not shown.
5 changes: 2 additions & 3 deletions IotaCSharpApi/Api/Core/AddNeighborsRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

namespace Iota.Lib.CSharp.Api.Core
{

/// <summary>
/// This class represents the core API request 'AddNeighbors'.
/// It is used to add a neighbor to the node
/// </summary>
/// <seealso cref="Iota.Lib.CSharp.Api.Core.IotaRequest" />
public class AddNeighborsRequest : IotaRequest
/// <seealso cref="IotaRequestBase" />
public class AddNeighborsRequest : IotaRequestBase
{
/// <summary>
/// Gets or sets the uris.
Expand Down
3 changes: 1 addition & 2 deletions IotaCSharpApi/Api/Core/AddNeighborsResponse.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
namespace Iota.Lib.CSharp.Api.Core
{

/// <summary>
/// Response of <see cref="AddNeighborsRequest"/>
/// </summary>
public class AddNeighborsResponse
public class AddNeighborsResponse : IotaResponseBase
{
/// <summary>
/// Gets the number of added neighbors.
Expand Down
3 changes: 1 addition & 2 deletions IotaCSharpApi/Api/Core/AttachToTangleRequest.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
namespace Iota.Lib.CSharp.Api.Core
{

/// <summary>
/// This class represents the core API request 'AttachToTangle'.
/// It is used to attach trytes to the tangle.
/// </summary>
public class AttachToTangleRequest : IotaRequest
public class AttachToTangleRequest : IotaRequestBase
{
private const int MinWeightMagnitudeMin = 18;
private int _minWeightMagnitude = MinWeightMagnitudeMin;
Expand Down
2 changes: 1 addition & 1 deletion IotaCSharpApi/Api/Core/AttachToTangleResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Iota.Lib.CSharp.Api.Core
/// <summary>
/// Response of <see cref="AttachToTangleRequest"/>
/// </summary>
public class AttachToTangleResponse
public class AttachToTangleResponse : IotaResponseBase
{
/// <summary>
/// Gets or sets the trytes.
Expand Down
2 changes: 1 addition & 1 deletion IotaCSharpApi/Api/Core/BroadcastTransactionsRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Iota.Lib.CSharp.Api.Core
/// <summary>
/// Broadcast a list of transactions to all neighbors. The input trytes for this call are provided by attachToTangle
/// </summary>
public class BroadcastTransactionsRequest : IotaRequest
public class BroadcastTransactionsRequest : IotaRequestBase
{
/// <summary>
/// Initializes a new instance of the <see cref="BroadcastTransactionsRequest"/> class.
Expand Down
2 changes: 1 addition & 1 deletion IotaCSharpApi/Api/Core/BroadcastTransactionsResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// <summary>
/// Response of <see cref="BroadcastTransactionsRequest"/>
/// </summary>
public class BroadcastTransactionsResponse
public class BroadcastTransactionsResponse : IotaResponseBase
{
// empty
}
Expand Down
5 changes: 3 additions & 2 deletions IotaCSharpApi/Api/Core/EnumHelper.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.ComponentModel;
using System.Linq;
using System.Reflection;

namespace Iota.Lib.CSharp.Api.Core
Expand All @@ -20,11 +21,11 @@ public static string GetCommandString(this Enum en)

MemberInfo[] memInfo = type.GetMember(en.ToString());

if (memInfo != null && memInfo.Length > 0)
if (memInfo.Any())
{
object[] attrs = memInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false);

if (attrs != null && attrs.Length > 0)
if (attrs.Any())
{
return ((DescriptionAttribute) attrs[0]).Description;
}
Expand Down
6 changes: 6 additions & 0 deletions IotaCSharpApi/Api/Core/ErrorResponse.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
namespace Iota.Lib.CSharp.Api.Core
{
/// <summary>
/// A simple class to hold an error message.
/// </summary>
internal class ErrorResponse
{
/// <summary>
/// A string representing the error that occurred.
/// </summary>
public string Error { get; set; }
}
}
2 changes: 1 addition & 1 deletion IotaCSharpApi/Api/Core/FindTransactionsRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Iota.Lib.CSharp.Api.Core
/// <summary>
/// This class represents the core api request 'FindTransactions'
/// </summary>
public class FindTransactionsRequest : IotaRequest
public class FindTransactionsRequest : IotaRequestBase
{
/// <summary>
/// Initializes a new instance of the <see cref="FindTransactionsRequest"/> class.
Expand Down
2 changes: 1 addition & 1 deletion IotaCSharpApi/Api/Core/FindTransactionsResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Iota.Lib.CSharp.Api.Core
/// <summary>
/// Response of <see cref="FindTransactionsRequest"/>
/// </summary>
public class FindTransactionsResponse
public class FindTransactionsResponse : IotaResponseBase
{
/// <summary>
/// Gets or sets the hashes.
Expand Down
80 changes: 40 additions & 40 deletions IotaCSharpApi/Api/Core/GetBalancesRequest.cs
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
using System.Collections.Generic;

namespace Iota.Lib.CSharp.Api.Core
{
/// <summary>
/// This class represents the core api request 'GetBalances'
/// </summary>
public class GetBalancesRequest : IotaRequest
{
/// <summary>
/// Initializes a new instance of the <see cref="GetBalancesRequest"/> class.
/// </summary>
/// <param name="addresses">The addresses.</param>
/// <param name="threshold">The threshold.</param>
public GetBalancesRequest(List<string> addresses, long threshold = 100)
: base(Core.Command.GetBalances.GetCommandString())
{
Addresses = addresses;
Threshold = threshold;
}

/// <summary>
/// Gets the threshold.
/// </summary>
/// <value>
/// The threshold.
/// </value>
public long Threshold { get; }

/// <summary>
/// Gets the addresses.
/// </summary>
/// <value>
/// The addresses.
/// </value>
using System.Collections.Generic;
namespace Iota.Lib.CSharp.Api.Core
{
/// <summary>
/// This class represents the core api request 'GetBalances'
/// </summary>
public class GetBalancesRequest : IotaRequestBase
{
/// <summary>
/// Initializes a new instance of the <see cref="GetBalancesRequest"/> class.
/// </summary>
/// <param name="addresses">The addresses.</param>
/// <param name="threshold">The threshold.</param>
public GetBalancesRequest(List<string> addresses, long threshold = 100)
: base(Core.Command.GetBalances.GetCommandString())
{
Addresses = addresses;
Threshold = threshold;
}
/// <summary>
/// Gets the threshold.
/// </summary>
/// <value>
/// The threshold.
/// </value>
public long Threshold { get; }
/// <summary>
/// Gets the addresses.
/// </summary>
/// <value>
/// The addresses.
/// </value>
public List<string> Addresses { get; }

/// <summary>
Expand All @@ -41,9 +41,9 @@ public GetBalancesRequest(List<string> addresses, long threshold = 100)
/// <returns>
/// A <see cref="System.String" /> that represents this instance.
/// </returns>
public override string ToString()
{
return $"{nameof(Threshold)}: {Threshold}, {nameof(Addresses)}: {string.Join(",",Addresses)}";
}
}
public override string ToString()
{
return $"{nameof(Threshold)}: {Threshold}, {nameof(Addresses)}: {string.Join(",",Addresses)}";
}
}
}
2 changes: 1 addition & 1 deletion IotaCSharpApi/Api/Core/GetBalancesResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Iota.Lib.CSharp.Api.Core
/// <summary>
/// Response of <see cref="GetBalancesRequest"/>
/// </summary>
public class GetBalancesResponse : IotaResponse
public class GetBalancesResponse : IotaResponseBase
{
/// <summary>
/// Gets or sets the balances.
Expand Down
4 changes: 2 additions & 2 deletions IotaCSharpApi/Api/Core/GetInclusionStatesRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/// <summary>
/// This class represents the core API request 'GetInclusionStates'
/// </summary>
/// <seealso cref="Iota.Lib.CSharp.Api.Core.IotaRequest" />
public class GetInclusionStatesRequest : IotaRequest
/// <seealso cref="IotaRequestBase" />
public class GetInclusionStatesRequest : IotaRequestBase
{
/// <summary>
/// Initializes a new instance of the <see cref="GetInclusionStatesRequest"/> class.
Expand Down
14 changes: 7 additions & 7 deletions IotaCSharpApi/Api/Core/GetInclusionStatesResponse.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
using System.Collections.Generic;

namespace Iota.Lib.CSharp.Api.Core
using System.Collections.Generic;
namespace Iota.Lib.CSharp.Api.Core
{
/// <summary>
/// This class represents the response of <see cref="GetInclusionStatesRequest"/>
/// </summary>
/// <seealso cref="Iota.Lib.CSharp.Api.Core.IotaResponse" />
public class GetInclusionStatesResponse : IotaResponse
/// <seealso cref="IotaResponseBase" />
public class GetInclusionStatesResponse : IotaResponseBase
{
/// <summary>
/// Gets or sets the states.
/// </summary>
/// <value>
/// The states.
/// </value>
public List<bool> States { get; set; }
}
public List<bool> States { get; set; }
}
}
4 changes: 2 additions & 2 deletions IotaCSharpApi/Api/Core/GetNeighborsRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/// <summary>
/// This class represents the core API request 'GetNeighbors'
/// </summary>
/// <seealso cref="Iota.Lib.CSharp.Api.Core.IotaRequest" />
public class GetNeighborsRequest : IotaRequest
/// <seealso cref="IotaRequestBase" />
public class GetNeighborsRequest : IotaRequestBase
{
/// <summary>
/// Initializes a new instance of the <see cref="GetNeighborsRequest"/> class.
Expand Down
22 changes: 11 additions & 11 deletions IotaCSharpApi/Api/Core/GetNeighborsResponse.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
using System.Collections.Generic;
using Iota.Lib.CSharp.Api.Model;

namespace Iota.Lib.CSharp.Api.Core
{
/// <summary>
/// Response of <see cref="GetNeighborsRequest"/>
/// </summary>
public class GetNeighborsResponse
using System.Collections.Generic;
using Iota.Lib.CSharp.Api.Model;
namespace Iota.Lib.CSharp.Api.Core
{
/// <summary>
/// Response of <see cref="GetNeighborsRequest"/>
/// </summary>
public class GetNeighborsResponse : IotaResponseBase
{
/// <summary>
/// Gets or sets the neighbors.
/// </summary>
/// <value>
/// The neighbors.
/// </value>
public List<Neighbor> Neighbors { get; set; }
}
public List<Neighbor> Neighbors { get; set; }
}
}
2 changes: 1 addition & 1 deletion IotaCSharpApi/Api/Core/GetNodeInfoRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// <summary>
/// Returns information about your node
/// </summary>
public class GetNodeInfoRequest : IotaRequest
public class GetNodeInfoRequest : IotaRequestBase
{
/// <summary>
/// Initializes a new instance of the <see cref="GetNodeInfoRequest"/> class.
Expand Down
4 changes: 2 additions & 2 deletions IotaCSharpApi/Api/Core/GetNodeInfoResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/// <summary>
/// This class represents the response of <see cref="GetNodeInfoRequest"/>
/// </summary>
/// <seealso cref="Iota.Lib.CSharp.Api.Core.IotaResponse" />
public class GetNodeInfoResponse : IotaResponse
/// <seealso cref="IotaResponseBase" />
public class GetNodeInfoResponse : IotaResponseBase
{
/// <summary>
/// Name of the IOTA software you're currently using (IRI stands for Initial Reference Implementation).
Expand Down
20 changes: 10 additions & 10 deletions IotaCSharpApi/Api/Core/GetTipsRequest.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
namespace Iota.Lib.CSharp.Api.Core
{
/// <summary>
/// This class represents the core API request 'GetTips'
/// </summary>
public class GetTipsRequest : IotaRequest
namespace Iota.Lib.CSharp.Api.Core
{
/// <summary>
/// This class represents the core API request 'GetTips'
/// </summary>
public class GetTipsRequest : IotaRequestBase
{
/// <summary>
/// Initializes a new instance of the <see cref="GetTipsRequest"/> class.
/// </summary>
public GetTipsRequest() : base(Core.Command.GetTips.GetCommandString())
{
}
}
public GetTipsRequest() : base(Core.Command.GetTips.GetCommandString())
{
}
}
}
Loading