-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/KrothuTheCoder/sampleService
- Loading branch information
Showing
8 changed files
with
235 additions
and
127 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "C#: <project-name> Debug", | ||
"type": "dotnet", | ||
"request": "launch", | ||
"projectPath": "${workspaceFolder}/DoSomethingService/DoSomethingService.csproj" | ||
} | ||
|
||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace DoSomethingService.Controllers.v1; | ||
|
||
/// <summary> | ||
/// This is an api to return some data in a made up senario | ||
/// </summary> | ||
[Route("api/v1/[controller]")] | ||
[ApiController] | ||
[ApiVersion("1.0")] | ||
public class SomethingController : ControllerBase | ||
{ | ||
private readonly ILogger<SomethingController> _logger; | ||
|
||
/// <summary> | ||
/// Setting up the code so it can do things | ||
/// </summary> | ||
/// <param name="logger">The logger so we know if things have been done</param> | ||
public SomethingController(ILogger<SomethingController> logger) | ||
{ | ||
_logger = logger; | ||
} | ||
|
||
/// <summary> | ||
/// If you need to do something then it will | ||
/// </summary> | ||
/// <returns>What happened</returns> | ||
[HttpGet("DoSomething")] | ||
[ApiExplorerSettings(GroupName ="v1")] | ||
public string Get() | ||
{ | ||
return $"You wanted me to do something, there I did something"; | ||
} | ||
|
||
/// <summary> | ||
/// If you need to do something then, just tell it | ||
/// what you want to do | ||
/// </summary> | ||
/// <param name="whatToDo">The thing you want it to do</param> | ||
/// <returns>What happened</returns> | ||
[HttpGet("WhatSomethingToDo")] | ||
[ApiExplorerSettings(GroupName ="v1")] | ||
public string Get(string whatToDo) | ||
{ | ||
return $"You wanted me to {whatToDo}, there I did something"; | ||
} | ||
|
||
/// <summary> | ||
/// If you want to post something for it to do | ||
/// </summary> | ||
/// <param name="whatToDo">The thing you want it to do</param> | ||
/// <returns>What happened</returns> | ||
[HttpPost("PostSomething")] | ||
[ApiExplorerSettings(GroupName ="v1")] | ||
public string Post(string whatToDo) | ||
{ | ||
return $"This was passed to me {whatToDo}, there I did something"; | ||
} | ||
} |
44 changes: 0 additions & 44 deletions
44
DoSomethingService/Controllers/v1/SomethingV1Controller.cs
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace DoSomethingService.Controllers.v2; | ||
|
||
/// <summary> | ||
/// This is an api to return some data in a made up senario | ||
/// </summary> | ||
[Route("api/v2/[controller]")] | ||
[ApiController] | ||
[ApiVersion("2.0")] | ||
public class SomethingController : ControllerBase | ||
{ | ||
private readonly ILogger<SomethingController> _logger; | ||
|
||
/// <summary> | ||
/// Setting up the code so it can do things | ||
/// </summary> | ||
/// <param name="logger">The logger so we know if things have been done</param> | ||
public SomethingController(ILogger<SomethingController> logger) | ||
{ | ||
_logger = logger; | ||
} | ||
|
||
/// <summary> | ||
/// If you need to do something then it will | ||
/// </summary> | ||
/// <returns>What happened</returns> | ||
[HttpGet("DoSomething")] | ||
[ApiExplorerSettings(GroupName ="v2")] | ||
public string Get() | ||
{ | ||
return $"You wanted me to do something, there I did something"; | ||
} | ||
|
||
/// <summary> | ||
/// If you need to do something then, just tell it | ||
/// what you want to do | ||
/// </summary> | ||
/// <param name="whatToDo">The thing you want it to do</param> | ||
/// <returns>What happened</returns> | ||
[HttpGet("WhatSomethingToDo")] | ||
[ApiExplorerSettings(GroupName ="v2")] | ||
public string Get(int whatToDo) | ||
{ | ||
return $"You wanted me to {whatToDo}, there I did something"; | ||
} | ||
|
||
/// <summary> | ||
/// If you want to post something for it to do | ||
/// </summary> | ||
/// <param name="whatToDo">The thing you want it to do</param> | ||
/// <returns>What happened</returns> | ||
[HttpPost("PostSomething")] | ||
[ApiExplorerSettings(GroupName ="v2")] | ||
public string Post(string whatToDo) | ||
{ | ||
return $"This was passed to me {whatToDo}, there I did something"; | ||
} | ||
|
||
/// <summary> | ||
/// If you need to do something then, just tell it | ||
/// what you want to do | ||
/// </summary> | ||
/// <param name="whatToDo">The thing you want it to do</param> | ||
/// <returns>What happened</returns> | ||
[HttpGet("WhatAnotherSomethingToDo")] | ||
[ApiExplorerSettings(GroupName ="v2")] | ||
public string GetAnother(int whatToDo) | ||
{ | ||
return $"You wanted me to {whatToDo}, there I did something"; | ||
} | ||
|
||
} |
44 changes: 0 additions & 44 deletions
44
DoSomethingService/Controllers/v2/SomethingV2Controller.cs
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.