Commit 287b338e authored by Jeremy Bokobza's avatar Jeremy Bokobza Committed by GitHub

Merge pull request #24 from stratisproject/feature/more-types

Added Swagger controller methods comments
parents 31db50fa b08ea8bc
<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,6 +57,13 @@ 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);
});
}
......
......@@ -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)
......@@ -114,6 +127,11 @@ namespace Breeze.Wallet.Controllers
}
}
/// <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