-
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.
- Loading branch information
Showing
35 changed files
with
1,075 additions
and
84 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
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 |
---|---|---|
|
@@ -4,6 +4,15 @@ | |
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks> | ||
<ImplicitUsings>disable</ImplicitUsings> | ||
<Nullable>disable</Nullable> | ||
<PackageId>TagShelf.Alfred.ApiWrapper</PackageId> | ||
<Version>0.1.0</Version> | ||
<Authors>Raúl Roa ([email protected])</Authors> | ||
<Company>Tagshelf</Company> | ||
<Description>A comprehensive .NET library designed to facilitate seamless interactions with the Alfred API.</Description> | ||
<PackageTags>Alfred;API;Wrapper;.NET</PackageTags> | ||
<RepositoryUrl>https://github.com/tagshelfsrl/dotnet-alfred-api-wrapper</RepositoryUrl> | ||
<PackageLicenseExpression>MIT</PackageLicenseExpression> | ||
<PackageReleaseNotes>Initial release of TagShelf.Alfred.ApiWrapper, supporting comprehensive authentication, domain-specific operations, and cross-platform compatibility.</PackageReleaseNotes> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
|
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
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
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,48 @@ | ||
using System; | ||
|
||
namespace TagShelf.Alfred.ApiWrapper.Core | ||
{ | ||
|
||
/// <summary> | ||
/// Represents errors that occur during API request execution. | ||
/// </summary> | ||
public class ApiException : Exception | ||
{ | ||
/// <summary> | ||
/// Gets the error code returned by the API. | ||
/// </summary> | ||
public string Error { get; } | ||
|
||
/// <summary> | ||
/// Gets the error message returned by the API. | ||
/// </summary> | ||
public string ErrorMessage { get; } | ||
|
||
/// <summary> | ||
/// Gets the HTTP status code of the response, if available. | ||
/// </summary> | ||
public System.Net.HttpStatusCode? StatusCode { get; } | ||
|
||
/// <summary> | ||
/// Gets the raw content of the error response. | ||
/// </summary> | ||
public string ResponseContent { get; } | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="ApiException"/> class with specified error details. | ||
/// </summary> | ||
/// <param name="error">The error code returned by the API.</param> | ||
/// <param name="errorMessage">The error message returned by the API.</param> | ||
/// <param name="statusCode">The HTTP status code of the response, if available.</param> | ||
/// <param name="responseContent">The raw content of the error response.</param> | ||
/// <param name="innerException">The inner exception, if any.</param> | ||
public ApiException(string error, string errorMessage, System.Net.HttpStatusCode? statusCode, string responseContent, Exception innerException = null) | ||
: base($"API error: {error} - {errorMessage}", innerException) | ||
{ | ||
Error = error; | ||
ErrorMessage = errorMessage; | ||
StatusCode = statusCode; | ||
ResponseContent = responseContent; | ||
} | ||
} | ||
} |
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,16 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace TagShelf.Alfred.ApiWrapper.Core | ||
{ | ||
/// <summary> | ||
/// Represents an error response from the API. | ||
/// </summary> | ||
public class ErrorResult | ||
{ | ||
[JsonProperty("error")] | ||
public string Error { get; set; } | ||
|
||
[JsonProperty("message")] | ||
public string Message { get; set; } | ||
} | ||
} |
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
28 changes: 28 additions & 0 deletions
28
AlfredApiWrapper/Domains/DataPointDomain/DataPointDomain.cs
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,28 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using TagShelf.Alfred.ApiWrapper.Core; | ||
using TagShelf.Alfred.ApiWrapper.Domains.DataPoint.Results; | ||
|
||
namespace TagShelf.Alfred.ApiWrapper.Domains.DataPoint | ||
{ | ||
public class DataPointDomain | ||
{ | ||
private readonly HttpApiClient _apiClient; | ||
|
||
public DataPointDomain(HttpApiClient apiClient) | ||
{ | ||
_apiClient = apiClient; | ||
} | ||
|
||
/// <summary> | ||
/// Fetches a list of metadata values for a given file ID. | ||
/// </summary> | ||
/// <param name="fileId">The unique identifier of the file.</param> | ||
/// <returns>A task that represents the asynchronous operation, containing a list of DataPointResult.</returns> | ||
public async Task<List<DataPointResult>> GetValuesAsync(Guid fileId) | ||
{ | ||
return await _apiClient.GetAsync<List<DataPointResult>>($"api/values/file/{fileId}").ConfigureAwait(false); | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
AlfredApiWrapper/Domains/DataPointDomain/Results/DataPointResult.cs
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,26 @@ | ||
using Newtonsoft.Json; | ||
using System; | ||
|
||
namespace TagShelf.Alfred.ApiWrapper.Domains.DataPoint.Results | ||
{ | ||
public class DataPointResult | ||
{ | ||
[JsonProperty("id")] | ||
public Guid Id { get; set; } | ||
|
||
[JsonProperty("file_log_id")] | ||
public Guid FileLogId { get; set; } | ||
|
||
[JsonProperty("metadata_id")] | ||
public Guid MetadataId { get; set; } | ||
|
||
[JsonProperty("metadata_name")] | ||
public string MetadataName { get; set; } | ||
|
||
[JsonProperty("value")] | ||
public string Value { get; set; } | ||
|
||
[JsonProperty("classification_score")] | ||
public double ClassificationScore { get; set; } | ||
} | ||
} |
Oops, something went wrong.