Commit b08ea8bc authored by Jeremy Bokobza's avatar Jeremy Bokobza

Added some comments to the controller methods

parent 79f14616
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework>
......@@ -11,6 +11,10 @@
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.6;portable-net45+win8</PackageTargetFallback>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>..\\Breeze.Deamon\\bin\\Debug\\netcoreapp1.0\\Breeze.Api.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="1.0.3" />
......
......@@ -15,6 +15,10 @@ namespace Breeze.Api.Controllers
this.blockNotification = blockNotification;
}
/// <summary>
/// Returns some general information about the status of the underlying node.
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("status")]
public IActionResult Status()
......@@ -22,6 +26,12 @@ namespace Breeze.Api.Controllers
return this.NotFound();
}
/// <summary>
/// Starts sending block to the wallet for synchronisation.
/// This is for demo and testing use only.
/// </summary>
/// <param name="model">The hash of the block from which to start syncing.</param>
/// <returns></returns>
[HttpPost]
[Route("sync")]
public IActionResult Sync([FromBody] HashModel model)
......
using System.Linq;
using System.IO;
using System.Linq;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.PlatformAbstractions;
using Swashbuckle.AspNetCore.Swagger;
namespace Breeze.Api
......@@ -55,7 +57,14 @@ namespace Breeze.Api
return true;
});
});
//Set the comments path for the swagger json and ui.
var basePath = PlatformServices.Default.Application.ApplicationBasePath;
var apiXmlPath = Path.Combine(basePath, "Breeze.Api.xml");
var walletXmlPath = Path.Combine(basePath, "Breeze.Wallet.xml");
setup.IncludeXmlComments(apiXmlPath);
setup.IncludeXmlComments(walletXmlPath);
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
......
......@@ -11,6 +11,10 @@
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>..\\Breeze.Deamon\\bin\\Debug\\netcoreapp1.0\\Breeze.Wallet.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="HBitcoin" Version="0.1.5" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="1.0.3" />
......
......@@ -11,6 +11,9 @@ using Breeze.Wallet.Wrappers;
namespace Breeze.Wallet.Controllers
{
/// <summary>
/// Controller providing operations on a wallet.
/// </summary>
[Route("api/v{version:apiVersion}/[controller]")]
public class WalletController : Controller
{
......@@ -49,6 +52,11 @@ namespace Breeze.Wallet.Controllers
}
}
/// <summary>
/// Loads a wallet previously created by the user.
/// </summary>
/// <param name="walletLoad">The name of the wallet to load.</param>
/// <returns></returns>
[Route("load")]
[HttpPost]
public IActionResult Load([FromBody]WalletLoadRequest walletLoad)
......@@ -81,6 +89,11 @@ namespace Breeze.Wallet.Controllers
}
}
/// <summary>
/// Recovers a wallet.
/// </summary>
/// <param name="walletRecovery">The object containing the parameters used to recover a wallet.</param>
/// <returns></returns>
[Route("recover")]
[HttpPost]
public IActionResult Recover([FromBody]WalletRecoveryRequest walletRecovery)
......@@ -113,8 +126,13 @@ namespace Breeze.Wallet.Controllers
return ErrorHelpers.BuildErrorResponse(HttpStatusCode.BadRequest, e.Message, e.ToString());
}
}
[Route("info")]
/// <summary>
/// Get some general info about a wallet.
/// </summary>
/// <param name="model">The name of the wallet.</param>
/// <returns></returns>
[Route("info")]
[HttpGet]
public IActionResult GetInfo([FromQuery] WalletName model)
{
......@@ -136,6 +154,11 @@ namespace Breeze.Wallet.Controllers
}
}
/// <summary>
/// Retrieves the history of a wallet.
/// </summary>
/// <param name="model">The name of the wallet.</param>
/// <returns></returns>
[Route("history")]
[HttpGet]
public IActionResult GetHistory([FromQuery] WalletName model)
......@@ -158,6 +181,11 @@ namespace Breeze.Wallet.Controllers
}
}
/// <summary>
/// Gets the balance of a wallet.
/// </summary>
/// <param name="model">The name of the wallet.</param>
/// <returns></returns>
[Route("balance")]
[HttpGet]
public IActionResult GetBalance([FromQuery] WalletName model)
......@@ -180,6 +208,11 @@ namespace Breeze.Wallet.Controllers
}
}
/// <summary>
/// Builds a transaction.
/// </summary>
/// <param name="request">The transaction parameters.</param>
/// <returns>All the details of the transaction, including the hex used to execute it.</returns>
[Route("build-transaction")]
[HttpPost]
public IActionResult BuildTransaction([FromBody] BuildTransactionRequest request)
......@@ -202,6 +235,11 @@ namespace Breeze.Wallet.Controllers
}
}
/// <summary>
/// Sends a transaction.
/// </summary>
/// <param name="request">The hex representing the transaction.</param>
/// <returns></returns>
[Route("send-transaction")]
[HttpPost]
public IActionResult SendTransaction([FromBody] SendTransactionRequest request)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment