chore: initial commit
This commit is contained in:
50
README.md
Normal file
50
README.md
Normal file
@@ -0,0 +1,50 @@
|
||||
# Novaloop.PaymoApi - Accessing Paymo Api
|
||||
|
||||
**Novaloop.PaymoApi** allows to access the paymo API.
|
||||
|
||||
## Implemented Methods
|
||||
|
||||
- Get an existing Task
|
||||
- Create a new Task
|
||||
|
||||
## Getting Started
|
||||
|
||||
### Startup.cs
|
||||
|
||||
The api client is added with the following configuration inside `ConfigureServices`.
|
||||
See https://github.com/paymoapp/api/blob/master/sections/authentication.md#using-sessions for how to acquire an api key.
|
||||
|
||||
```csharp
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddPaymoApi(options =>
|
||||
{
|
||||
options.ApiKey = "your-api-key";
|
||||
});
|
||||
services.AddControllers();
|
||||
}
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
Now the Api Services can be injected via dependency injection inside controllers / services:
|
||||
|
||||
```csharp
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class ExampleController : ControllerBase
|
||||
{
|
||||
private readonly IPaymoTaskApiService _paymoTaskService;
|
||||
|
||||
public ExampleController(IPaymoTaskApiService paymoTaskService)
|
||||
{
|
||||
_paymoTaskService = paymoTaskService;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> Get()
|
||||
{
|
||||
return Ok(await _paymoTaskService.GetTask(11));
|
||||
}
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user