This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class ApiFunctionBase | |
{ | |
public ILogger Logger { get; protected set; } | |
public HttpRequest Request { get; protected set; } | |
protected virtual ApiError GetExceptionApiError(Exception e) | |
{ | |
return new ApiError | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[SwaggerIgnore] | |
[FunctionName("Swagger")] | |
public static Task<HttpResponseMessage> Run( | |
[HttpTrigger(AuthorizationLevel.Function, "get", Route = "swagger/json")] | |
HttpRequestMessage req, | |
[SwashBuckleClient] ISwashBuckleClient swashBuckleClient) | |
{ | |
return Task.FromResult(swashBuckleClient.CreateSwaggerDocumentResponse(req)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ProductCreateRequest | |
{ | |
/// <summary> | |
/// Sku | |
/// </summary> | |
[MaxLength(32)] | |
[Required] | |
[JsonProperty("sku")] | |
public string Sku { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[RequestHttpHeader("Idempotency-Key", isRequired: false)] | |
[RequestHttpHeader("Authorization", isRequired: true)] | |
[FunctionName("Api_AddItems")] | |
public async Task<IActionResult> Create( | |
[HttpTrigger(AuthorizationLevel.Function, "post", "product")] | |
[RequestBodyType(typeof(ProductCreateRequest), "product request")]HttpRequest request) | |
{ | |
return new OkObjectResult(new ProductModel()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[FunctionName("Api_AddItems")] | |
public async Task<IActionResult> Create( | |
[HttpTrigger(AuthorizationLevel.Function, "post", "product")] | |
[RequestBodyType(typeof(ProductCreateRequest), "product request")]HttpRequest request) | |
{ | |
return new OkObjectResult(new ProductModel()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(ProductModel[]))] | |
[ProducesResponseType((int)HttpStatusCode.InternalServerError, Type = typeof(Error))] | |
[FunctionName("Api_GetItems")] | |
public async Task<IActionResult> GetItems( | |
[HttpTrigger(AuthorizationLevel.Function, "get", "product")]HttpRequest request) | |
{ | |
return new OkObjectResult(new List<ProductModel>()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel.DataAnnotations; | |
using System.Net; | |
using System.Text; | |
using System.Threading.Tasks; | |
using AzureFunctions.Extensions.Swashbuckle.Attribute; | |
using Microsoft.AspNetCore.Http; | |
using Microsoft.AspNetCore.Mvc; | |
using Microsoft.Azure.WebJobs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Net.Http; | |
using System.Threading.Tasks; | |
using AzureFunctions.Extensions.Swashbuckle; | |
using AzureFunctions.Extensions.Swashbuckle.Attribute; | |
using Microsoft.Azure.WebJobs; | |
using Microsoft.Azure.WebJobs.Extensions.Http; | |
namespace SampleFunction | |
{ | |
public static class SwaggerFunctions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Reflection; | |
using AzureFunctions.Extensions.Swashbuckle; | |
using Microsoft.Azure.WebJobs; | |
using Microsoft.Azure.WebJobs.Hosting; | |
using SampleFunction; | |
[assembly: WebJobsStartup(typeof(SwashBuckleStartup))] | |
namespace SampleFunction | |
{ | |
internal class SwashBuckleStartup : IWebJobsStartup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class EntityBase | |
{ | |
public abstract string Name { get; } | |
} | |
public abstract class RepositoryBase<T> where T : EntityBase | |
{ | |
private readonly string _name; | |
public RepositoryBase() |
NewerOlder