123456789101112131415161718192021222324252627282930313233 |
- using static CompServ.CompServConst;
- using HttpMethod = System.Net.Http.HttpMethod;
- using HttpVersion = System.Net.HttpVersion;
- namespace CompServ.ClientLibrary
- {
- public class CompServWorkerClient(string server) : CompServClient(server, ApiPathWorkerRootForCheckAlive, AliveMessageWorker)
- {
- public async Task<byte[]> CompressAsync(CompressRequestModel request)
- {
- var message = request.BuildRequestMessage();
- var http = new HttpClient { BaseAddress = ServerUri };
- var r = await http.SendAsync(message);
- r.EnsureSuccessStatusCode();
- var compressedBytes = await r.Content.ReadAsByteArrayAsync();
- return compressedBytes;
- }
- public async Task<byte[]> DecompressAsync(DecompressRequestModel request)
- {
- var message = request.BuildRequestMessage();
- var http = new HttpClient { BaseAddress = ServerUri };
- var r = await http.SendAsync(message);
- r.EnsureSuccessStatusCode();
- var bytes = await r.Content.ReadAsByteArrayAsync();
- return bytes;
- }
- }
- }
|