chore: fixes api base-url
This commit is contained in:
@@ -2,7 +2,7 @@ namespace Novaloop.PaymoApi.Extensions
|
|||||||
{
|
{
|
||||||
public class PaymoApiOptions
|
public class PaymoApiOptions
|
||||||
{
|
{
|
||||||
public string BaseUrl { get; set; } = "https://app.paymoapp.com/api";
|
public string BaseUrl { get; set; } = "https://app.paymoapp.com/";
|
||||||
public string ApiToken { get; set; }
|
public string ApiToken { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
<PackageId>Novaloop.PaymoApi</PackageId>
|
<PackageId>Novaloop.PaymoApi</PackageId>
|
||||||
<title>Access your paymo instance for asp.net core</title>
|
<title>Access your paymo instance for asp.net core</title>
|
||||||
<PackageTags>api;paymo;asp.net core;</PackageTags>
|
<PackageTags>api;paymo;asp.net core;</PackageTags>
|
||||||
<Version>0.1.0</Version>
|
<Version>0.1.9</Version>
|
||||||
<Authors>Matthias Langhard</Authors>
|
<Authors>Matthias Langhard</Authors>
|
||||||
<Company>Novaloop AG</Company>
|
<Company>Novaloop AG</Company>
|
||||||
<PackageProjectUrl>https://gitlab.com/novaloop-oss/novaloop.paymoapi</PackageProjectUrl>
|
<PackageProjectUrl>https://gitlab.com/novaloop-oss/novaloop.paymoapi</PackageProjectUrl>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace Novaloop.PaymoApi.Tasks
|
|||||||
{
|
{
|
||||||
public interface IPaymoTasksApiService
|
public interface IPaymoTasksApiService
|
||||||
{
|
{
|
||||||
|
Task<GetTasksResponse> GetTasks();
|
||||||
Task<GetTasksResponse> GetTask(int taskId);
|
Task<GetTasksResponse> GetTask(int taskId);
|
||||||
Task<CreateTaskResponse> CreateTask(CreateTaskRequest createTask);
|
Task<CreateTaskResponse> CreateTask(CreateTaskRequest createTask);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,20 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Novaloop.PaymoApi.Tasks.Models
|
namespace Novaloop.PaymoApi.Tasks.Models
|
||||||
{
|
{
|
||||||
public class CreateTaskRequest
|
public class CreateTaskRequest
|
||||||
{
|
{
|
||||||
|
[JsonProperty(PropertyName = "name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty(PropertyName = "description")]
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty(PropertyName = "tasklist_id")]
|
||||||
public int TasklistId { get; set; }
|
public int TasklistId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty(PropertyName = "users")]
|
||||||
public List<int> Users { get; set; }
|
public List<int> Users { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -19,12 +19,25 @@ namespace Novaloop.PaymoApi.Tasks
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get an existing Task
|
/// Receive all existing tasks
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
public async Task<GetTasksResponse> GetTasks()
|
||||||
|
{
|
||||||
|
_client.SetApiKeyHeader(_options.ApiToken);
|
||||||
|
var response = await _client.GetAsync($"api/tasks");
|
||||||
|
await response.ThrowExceptionWithDetailsIfUnsuccessful();
|
||||||
|
return await response.Content.ReadAsAsync<GetTasksResponse>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve an existing Task by id
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="taskId">id of the task</param>
|
||||||
|
/// <returns></returns>
|
||||||
public async Task<GetTasksResponse> GetTask(int taskId)
|
public async Task<GetTasksResponse> GetTask(int taskId)
|
||||||
{
|
{
|
||||||
_client.SetApiKeyHeader(_options.ApiToken);
|
_client.SetApiKeyHeader(_options.ApiToken);
|
||||||
var response = await _client.GetAsync($"/tasks/{taskId}");
|
var response = await _client.GetAsync($"api/tasks/{taskId}");
|
||||||
await response.ThrowExceptionWithDetailsIfUnsuccessful();
|
await response.ThrowExceptionWithDetailsIfUnsuccessful();
|
||||||
return await response.Content.ReadAsAsync<GetTasksResponse>();
|
return await response.Content.ReadAsAsync<GetTasksResponse>();
|
||||||
}
|
}
|
||||||
@@ -36,7 +49,7 @@ namespace Novaloop.PaymoApi.Tasks
|
|||||||
public async Task<CreateTaskResponse> CreateTask(CreateTaskRequest createTaskRequest)
|
public async Task<CreateTaskResponse> CreateTask(CreateTaskRequest createTaskRequest)
|
||||||
{
|
{
|
||||||
_client.SetApiKeyHeader(_options.ApiToken);
|
_client.SetApiKeyHeader(_options.ApiToken);
|
||||||
var response = await _client.PostAsJsonAsync("/tasks", createTaskRequest);
|
var response = await _client.PostAsJsonAsync("api/tasks", createTaskRequest);
|
||||||
await response.ThrowExceptionWithDetailsIfUnsuccessful();
|
await response.ThrowExceptionWithDetailsIfUnsuccessful();
|
||||||
return await response.Content.ReadAsAsync<CreateTaskResponse>();
|
return await response.Content.ReadAsAsync<CreateTaskResponse>();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user