Gestiti salvataggi rest
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using IntegryApiClient.Core.Domain.RestClient.Contacts;
|
||||
using System.Net.Http.Headers;
|
||||
using IntegryApiClient.Core.Domain.RestClient.Contacts;
|
||||
using SteUp.Shared.Core.Dto;
|
||||
using SteUp.Shared.Core.Interface.IntegryApi;
|
||||
|
||||
@@ -31,5 +32,39 @@ public class IntegrySteupService(IIntegryApiRestClient integryApiRestClient) : I
|
||||
}
|
||||
);
|
||||
|
||||
public Task<List<StbActivityDto>?> RetrieveStatoIspezioni(RetrieveStatoIspezioniRequestDto request) =>
|
||||
integryApiRestClient.AuthorizedPost<List<StbActivityDto>?>($"{BaseRequest}/retrieveStatoIspezioni", request);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Save
|
||||
|
||||
public Task<SaveSchedaResponseDto?> SaveScheda(SaveRequestDto request) =>
|
||||
integryApiRestClient.AuthorizedPost<SaveSchedaResponseDto?>($"{BaseRequest}/saveScheda", request);
|
||||
|
||||
public Task<SaveSchedaResponseDto?> SaveMultipleSchede(List<SaveRequestDto> request) =>
|
||||
integryApiRestClient.AuthorizedPost<SaveSchedaResponseDto?>($"{BaseRequest}/saveMultipleSchede", request);
|
||||
|
||||
public Task CompleteInspection(string activityId) =>
|
||||
integryApiRestClient.AuthorizedPost<object>(
|
||||
$"{BaseRequest}/complete",
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "activityId", activityId }
|
||||
}
|
||||
);
|
||||
|
||||
#endregion
|
||||
|
||||
public Task UploadFile(string activityId, byte[] file, string fileName)
|
||||
{
|
||||
var queryParams = new Dictionary<string, object> { { "activityId", activityId } };
|
||||
|
||||
using var content = new MultipartFormDataContent();
|
||||
var fileContent = new ByteArrayContent(file);
|
||||
fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse("multipart/form-data");
|
||||
content.Add(fileContent, "file", fileName);
|
||||
|
||||
return integryApiRestClient.Post<object>($"{BaseRequest}/uploadAttachment", content, queryParams!);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user