Hi!
I tried to download the PDF by calling GetDocumentFile but there was no suitable class to pass. The call returns the file contents as a string so I had to update the ApiResponse.GetResponse<() call with the following addition:
string responseBody = await response.Content.ReadAsStringAsync();
// 2020-12-29 Necessary to get the PDF data
if (typeof(TResult) == typeof(string))
{
return (TResult)Convert.ChangeType(responseBody, typeof(TResult));
}
return JsonConvert.DeserializeObject<TResult>(responseBody);
Now I'm able to get the PDF with the following:
string str_data = await vsign.SendRequest(
GetDocumentFile.FromDocument(loc.Uuid, 0)
);
byte[] data = Encoding.UTF8.GetBytes(str_data);
File.WriteAllBytes(
One could absolutely create a specific class to handle this like the LocationDto but this is good enough and it's flexible because you can always get the raw string response from the call.
Hi!
I tried to download the PDF by calling GetDocumentFile but there was no suitable class to pass. The call returns the file contents as a string so I had to update the ApiResponse.GetResponse<() call with the following addition:
string responseBody = await response.Content.ReadAsStringAsync();
Now I'm able to get the PDF with the following:
string str_data = await vsign.SendRequest(
GetDocumentFile.FromDocument(loc.Uuid, 0)
);
byte[] data = Encoding.UTF8.GetBytes(str_data);
File.WriteAllBytes(
One could absolutely create a specific class to handle this like the LocationDto but this is good enough and it's flexible because you can always get the raw string response from the call.