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