Ejemplo n.º 1
0
 public void GetDocuments()
 {
     using (PandaDocHttpClient client = EnsureLoggedIn().Result)
     {
         PandaDocHttpResponse <GetDocumentsResponse> response = client.GetDocuments().Result;
         response.AssertOk();
     }
 }
Ejemplo n.º 2
0
        public async void GetDocumentsAsync()
        {
            using (PandaDocHttpClient client = await EnsureLoggedIn())
            {
                PandaDocHttpResponse <GetDocumentsResponse> response = await client.GetDocuments();

                response.AssertOk();
            }
        }
Ejemplo n.º 3
0
        public async void DeleteDocument()
        {
            using (PandaDocHttpClient client = await EnsureLoggedIn())
            {
                string uuid = "FRkUcECJzFtCBTSFugsaF5";

                PandaDocHttpResponse response = await client.DeleteDocument(uuid);

                response.AssertOk();
            }
        }
Ejemplo n.º 4
0
        public void CreateDocument()
        {
            using (PandaDocHttpClient client = EnsureLoggedIn().Result)
            {
                CreateDocumentRequest request = CreateDocumentRequest();

                PandaDocHttpResponse <CreateDocumentResponse> response = client.CreateDocument(request).Result;

                response.AssertOk();
            }
        }
Ejemplo n.º 5
0
        public async void CreateDocumentAsync()
        {
            using (PandaDocHttpClient client = await EnsureLoggedIn())
            {
                CreateDocumentRequest request = CreateDocumentRequest();

                PandaDocHttpResponse <CreateDocumentResponse> response = await client.CreateDocument(request);

                response.AssertOk();
            }
        }
Ejemplo n.º 6
0
        public async void LoginAsync()
        {
            using (var client = new PandaDocHttpClient())
            {
                PandaDocHttpResponse <PandaDocBearerToken> response = await client.Login(username : Username, password : Password);

                response.AssertOk();

                Assert.NotNull(response.Value.AccessToken);
                Assert.NotNull(response.Value.RefreshToken);
            }
        }
Ejemplo n.º 7
0
        public async void SendDocument()
        {
            using (PandaDocHttpClient client = await EnsureLoggedIn())
            {
                var createRequest  = CreateDocumentRequest();
                var createResponse = await client.CreateDocument(createRequest);

                Console.WriteLine("Document '{0}' was uploaded", createResponse.Value.Uuid);

                // we have to wait for the document to move from document.uploaded to document.draft before you can send it.
                var attempts = 0;
                while (true)
                {
                    var getResponse = await client.GetDocument(createResponse.Value.Uuid);

                    if (getResponse.Value.DocumentStatus == DocumentStatus.Draft)
                    {
                        Console.WriteLine("Document '{0}' has moved to draft", createResponse.Value.Uuid);
                        break;
                    }

                    await Task.Delay(1000);

                    attempts++;

                    if (attempts == 5)
                    {
                        Assert.Fail();
                    }
                }

                var sendRequest = new SendDocumentRequest
                {
                    Message = "Please sign this document"
                };

                PandaDocHttpResponse <SendDocumentResponse> response = await client.SendDocument(createResponse.Value.Uuid, sendRequest);

                response.AssertOk();

                Console.WriteLine("Document '{0}' was sent", response.Value.Uuid);
            }
        }
Ejemplo n.º 8
0
        public async void GetDocument()
        {
            using (PandaDocHttpClient client = await EnsureLoggedIn())
            {
                //var createRequest = CreateDocumentRequest();
                //var createResponse = await client.CreateDocument(createRequest);
                //var uuid = createResponse.Value.Uuid;
                var uuid = "9x5fr622ME6rpcG277Nx8C";

                PandaDocHttpResponse <GetDocumentResponse> response = await client.GetDocument(uuid);

                response.AssertOk();

                Console.WriteLine("Document '{0}' has status '{1}'", response.Value.Uuid, response.Value.Status);

                foreach (Recipient recipient in response.Value.Recipients)
                {
                    Console.WriteLine("Recipient '{0} {1}' completed: {2}", recipient.FirstName, recipient.LastName, recipient.HasCompleted);
                }
            }
        }