Skip to content

Commit 2aa70cb

Browse files
committed
Version 4.0.104. details query param added to get by id resources.
1 parent e901618 commit 2aa70cb

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

Abstractions/BaseFiscalApiService.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,14 @@ public virtual Task<ApiResponse<PagedList<T>>> GetListAsync(int pageNumber, int
6161
return HttpClient.GetAsync<PagedList<T>>(BuildEndpoint(queryParams: queryParams));
6262
}
6363

64-
public virtual Task<ApiResponse<T>> GetByIdAsync(string id)
65-
=> HttpClient.GetByIdAsync<T>(BuildEndpoint(id));
64+
public virtual Task<ApiResponse<T>> GetByIdAsync(string id, bool details = false)
65+
{
66+
var parameters = new Dictionary<string, string>
67+
{
68+
{ "details", details.ToString().ToLower() }
69+
};
70+
return HttpClient.GetByIdAsync<T>(BuildEndpoint(id, parameters));
71+
}
6672

6773
public virtual Task<ApiResponse<T>> CreateAsync(T entity)
6874
=> HttpClient.PostAsync<T>(BuildEndpoint(), entity);
@@ -72,6 +78,5 @@ public virtual Task<ApiResponse<T>> UpdateAsync(string id, T entity)
7278

7379
public virtual Task<ApiResponse<bool>> DeleteAsync(string id)
7480
=> HttpClient.DeleteAsync(BuildEndpoint(id));
75-
7681
}
7782
}

Abstractions/IFiscalApiService.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,17 @@ namespace Fiscalapi.Abstractions
1010
public interface IFiscalApiService<T> where T : BaseDto
1111
{
1212
Task<ApiResponse<PagedList<T>>> GetListAsync(int pageNumber, int pageSize);
13-
Task<ApiResponse<T>> GetByIdAsync(string id);
13+
14+
/// <summary>
15+
/// Obtiene un recurso por su id y opcionalmente expandir sus objetos relacionados (detalles)
16+
/// </summary>
17+
/// <param name="id">Id del recurso</param>
18+
/// <param name="details">True para obtener los objetos relacionados, de lo contrario False.</param>
19+
/// <returns></returns>
20+
Task<ApiResponse<T>> GetByIdAsync(string id, bool details = false);
21+
1422
Task<ApiResponse<T>> CreateAsync(T model);
1523
Task<ApiResponse<T>> UpdateAsync(string id, T model);
1624
Task<ApiResponse<bool>> DeleteAsync(string id);
1725
}
18-
1926
}

fiscalapi-net.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFrameworks>netstandard2.0;net461;net48;netcoreapp3.1;net5.0;net6.0;net8.0</TargetFrameworks>
5-
<Version>4.0.96</Version>
5+
<Version>4.0.104</Version>
66
<AssemblyVersion>$(Version)</AssemblyVersion>
77
<FileVersion>$(Version)</FileVersion>
88
<PackageVersion>$(Version)</PackageVersion>

0 commit comments

Comments
 (0)