Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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;
        }
Exemplo n.º 3
0
        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;
        }