Skip to content

Commit

Permalink
Merge branch 'feature/247' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
i4004 committed Dec 20, 2023
2 parents 8c6fe4a + 4420c73 commit 2bfdb01
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 45 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:

steps:
- name: Code Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4.1.1

- name: Install DotNet
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4

- name: Restore Dependencies
run: dotnet restore
Expand Down
17 changes: 7 additions & 10 deletions src/Simplify.Web/Responses/Created.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
namespace Simplify.Web.Responses;

/// <summary>
/// Provides Creted controller string response with 201 HTTP Status Code
/// Provides Created controller string response with 201 HTTP Status Code
/// </summary>
public class Created : Content
/// <remarks>
/// Initializes a new instance of the <see cref="Created" /> class.
/// </remarks>
/// <param name="content">The string content.</param>
/// <param name="contentType">Type of the content.</param>
public class Created(string content, string contentType = "text/plain") : Content(content, 201, contentType)

Check failure on line 11 in src/Simplify.Web/Responses/Created.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The feature 'primary constructors' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version.

Check failure on line 11 in src/Simplify.Web/Responses/Created.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The feature 'primary constructors' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version.

Check failure on line 11 in src/Simplify.Web/Responses/Created.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The feature 'primary constructors' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version.

Check failure on line 11 in src/Simplify.Web/Responses/Created.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The feature 'primary constructors' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version.
{
/// <summary>
/// Initializes a new instance of the <see cref="Created" /> class.
/// </summary>
/// <param name="content">The string content.</param>
/// <param name="contentType">Type of the content.</param>
public Created(string content, string contentType = "text/plain") : base(content, 201, contentType)
{
}
}
28 changes: 11 additions & 17 deletions src/Simplify.Web/Responses/StaticTpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +6,39 @@ namespace Simplify.Web.Responses;
/// <summary>
/// Provides template response (loads template and puts it to DataCollector)
/// </summary>
public class StaticTpl : ControllerResponse
/// <remarks>
/// Initializes a new instance of the <see cref="Tpl" /> class.
/// </remarks>
/// <param name="templateFileName">Name of the template file.</param>
/// <param name="title">The title.</param>
/// <param name="statusCode">The HTTP response status code.</param>
/// <exception cref="ArgumentNullException"></exception>
public class StaticTpl(string templateFileName, string? title = null, int statusCode = 200) : ControllerResponse

Check failure on line 16 in src/Simplify.Web/Responses/StaticTpl.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The feature 'primary constructors' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version.

Check failure on line 16 in src/Simplify.Web/Responses/StaticTpl.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The feature 'primary constructors' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version.

Check failure on line 16 in src/Simplify.Web/Responses/StaticTpl.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The feature 'primary constructors' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version.
{
/// <summary>
/// Initializes a new instance of the <see cref="Tpl" /> class.
/// </summary>
/// <param name="templateFileName">Name of the template file.</param>
/// <param name="title">The title.</param>
/// <param name="statusCode">The HTTP response status code.</param>
/// <exception cref="ArgumentNullException"></exception>
public StaticTpl(string templateFileName, string? title = null, int statusCode = 200)
{
TemplateFileName = templateFileName ?? throw new ArgumentNullException(nameof(templateFileName));
Title = title;
StatusCode = statusCode;
}

/// <summary>
/// Gets the name of the template file.
/// </summary>
/// <value>
/// The name of the template file.
/// </value>
public string TemplateFileName { get; }
public string TemplateFileName { get; } = templateFileName ?? throw new ArgumentNullException(nameof(templateFileName));

/// <summary>
/// Gets the HTTP response status code.
/// </summary>
/// <value>
/// The HTTP response status code.
/// </value>
public int StatusCode { get; }
public int StatusCode { get; } = statusCode;

/// <summary>
/// Gets the name of the string table title item.
/// </summary>
/// <value>
/// The name of the string table title item.
/// </value>
private string? Title { get; }
private string? Title { get; } = title;

/// <summary>
/// Processes this response
Expand Down
26 changes: 10 additions & 16 deletions src/Simplify.Web/Responses/StatusCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,38 @@ namespace Simplify.Web.Responses;
/// <summary>
/// Provides controller response with exact status code and optional string data (send only specified string to response or empty body)
/// </summary>
public class StatusCode : ControllerResponse
/// <remarks>
/// Initializes a new instance of the <see cref="StatusCode" /> class.
/// </remarks>
/// <param name="statusCode">The HTTP response status code.</param>
/// <param name="responseData">The response data.</param>
/// <param name="contentType">Type of the content.</param>
public class StatusCode(int statusCode, string? responseData = null, string? contentType = "text/plain") : ControllerResponse

Check failure on line 14 in src/Simplify.Web/Responses/StatusCode.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The feature 'primary constructors' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version.

Check failure on line 14 in src/Simplify.Web/Responses/StatusCode.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The feature 'primary constructors' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version.

Check failure on line 14 in src/Simplify.Web/Responses/StatusCode.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The feature 'primary constructors' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version.
{
/// <summary>
/// Initializes a new instance of the <see cref="StatusCode" /> class.
/// </summary>
/// <param name="statusCode">The HTTP response status code.</param>
/// <param name="responseData">The response data.</param>
/// <param name="contentType">Type of the content.</param>
public StatusCode(int statusCode, string? responseData = null, string? contentType = null)
{
Code = statusCode;
ResponseData = responseData;
ContentType = contentType;
}

/// <summary>
/// Gets the response data.
/// </summary>
/// <value>
/// The response data.
/// </value>
public string? ResponseData { get; }
public string? ResponseData { get; } = responseData;

/// <summary>
/// Gets the type of the content.
/// </summary>
/// <value>
/// The type of the content.
/// </value>
public string? ContentType { get; }
public string? ContentType { get; } = contentType;

/// <summary>
/// Gets the HTTP response status code.
/// </summary>
/// <value>
/// The HTTP response status code.
/// </value>
public int Code { get; }
public int Code { get; } = statusCode;

/// <summary>
/// Processes this response
Expand Down

0 comments on commit 2bfdb01

Please sign in to comment.