private void AssertOk(PdfEndpointType type, Guid id) { var pdf = Api.PdfFiles.Get(type, id); var expected = id.ToString("D") + ".pdf"; Assert.NotNull(pdf); Assert.AreEqual(expected, pdf.FileName); }
public async Task<BinaryFile> GetAsync(PdfEndpointType type, Guid parent) { var response = await Client.Client.GetRawAsync(string.Format("/api.xro/2.0/{0}/{1}", type, parent.ToString("D")), "application/pdf"); if (response.StatusCode == HttpStatusCode.OK) { return new BinaryFile(response.Stream, parent.ToString("D") + ".pdf", response.ContentType, response.ContentLength); } Client.HandleErrors(response); return null; }
public BinaryFile Get(PdfEndpointType type, Guid parent) { var data = Client.Client.GetRaw(string.Format("/api.xro/2.0/{0}/{1}", type, parent.ToString("D")), "application/pdf"); if (data.StatusCode == HttpStatusCode.OK) { return new BinaryFile(data.Stream, parent.ToString("D") + ".pdf", data.ContentType, data.ContentLength); } Client.HandleErrors(data); return null; }