• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Client.RequestInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中DocuSign.Integrations.Client.RequestInfo的典型用法代码示例。如果您正苦于以下问题:C# RequestInfo类的具体用法?C# RequestInfo怎么用?C# RequestInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RequestInfo类属于DocuSign.Integrations.Client命名空间,在下文中一共展示了RequestInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Provisioning

        /// <summary>
        /// Account provisioning
        /// </summary>
        /// <returns>true if successful, false otherwise</returns>
        public bool Provisioning()
        {
            try
            {
                RequestInfo req = new RequestInfo();
                RequestBuilder builder = new RequestBuilder();

                req.RequestContentType = "application/json";
                req.AcceptContentType = "application/json";
                req.HttpMethod = "GET";
                req.LoginEmail = this.Email;
                req.LoginPassword = string.IsNullOrEmpty(this.ApiPassword) == false ? this.ApiPassword : this.Password;
                req.DistributorCode = RestSettings.Instance.DistributorCode;
                req.DistributorPassword = RestSettings.Instance.DistributorPassword;
                req.IntegratorKey = RestSettings.Instance.IntegratorKey;
                req.Uri = string.Format("{0}{1}", RestSettings.Instance.WebServiceUrl, "/provisioning.json");

                builder.Request = req;
                builder.Proxy = this.Proxy;

                ResponseInfo response = builder.MakeRESTRequest();

                this.Trace(builder, response);

                if (response.StatusCode != HttpStatusCode.OK)
                {
                    this.ParseErrorResponse(response);
                }
                else
                {
                    this.ParseLoginResponse(response);
                }

                return response.StatusCode == HttpStatusCode.OK;
            }
            catch
            {
                return false;
            }
        }
开发者ID:kvvora,项目名称:DocuSign-.NET-Client,代码行数:44,代码来源:Account.cs


示例2: AddEmailInformation

        /// <summary>
        /// Add subject and blurb information for an envelope one is sending
        /// </summary>
        /// <param name="subject">Email subject</param>
        /// <param name="blurb">Email body</param>
        /// <returns>true if successful, false otherwise</returns>
        public bool AddEmailInformation(string subject, string blurb)
        {
            // for now just support adding all email details. We can expand if needed.
            if (String.IsNullOrEmpty(subject) || String.IsNullOrEmpty(blurb))
            {
                return false;
            }

            try
            {
                RequestInfo req = new RequestInfo();
                req.RequestContentType = "application/json";
                req.AcceptContentType = "application/json";
                req.BaseUrl = Login.BaseUrl;
                req.LoginEmail = Login.Email;
                req.LoginPassword = Login.Password;
                req.ApiPassword = Login.ApiPassword;
                req.Uri = String.Format("/envelopes/{0}", EnvelopeId);
                req.HttpMethod = "PUT";
                req.IntegratorKey = RestSettings.Instance.IntegratorKey;

                RequestBuilder builder = new RequestBuilder();
                builder.Proxy = Proxy;
                builder.Request = req;

                List<RequestBody> requestBodies = new List<RequestBody>();
                RequestBody rb = new RequestBody();

                var emailDetails = new Dictionary<string, string>(){
                    {"emailBlurb", blurb},
                    {"emailSubject", subject}
                };

                rb.Text = JsonConvert.SerializeObject(emailDetails);
                requestBodies.Add(rb);
                req.RequestBody = requestBodies.ToArray();
                builder.Request = req;
                ResponseInfo response = builder.MakeRESTRequest();
                this.Trace(builder, response);

                if (response.StatusCode != HttpStatusCode.OK)
                {
                    this.ParseErrorResponse(response);
                }

                return response.StatusCode == HttpStatusCode.OK;
            }
            catch (Exception ex)
            {
                if (ex is WebException || ex is NotSupportedException || ex is InvalidOperationException || ex is ProtocolViolationException)
                {
                    // Once we get the debugging logger integrated into this project, we should write a log entry here
                    return false;
                }

                throw;
            }
        }
开发者ID:kvvora,项目名称:DocuSign-.NET-Client,代码行数:64,代码来源:Envelope.cs


示例3: UpdateRecipients

        /// <summary>
        /// Update recipients in the envelope
        /// </summary>
        /// <param name="recipients"></param>
        /// <param name="resendEnvelope">True or false setting that defaults to false. 
        /// Setting this to true will resend the envelope to the recipient. 
        /// The resend_envelope flag is only used to resend an In Process envelope.</param>
        /// <returns>true if successful, false otherwise</returns>
        public bool UpdateRecipients(Recipients recipients, bool resendEnvelope = false)
        {
            try
            {
                RequestInfo req = new RequestInfo();
                req.RequestContentType = "application/json";
                req.AcceptContentType = "application/json";
                req.BaseUrl = Login.BaseUrl;
                req.LoginEmail = Login.Email;
                req.LoginPassword = Login.Password;
                req.ApiPassword = Login.ApiPassword;
                req.Uri = String.Format(resendEnvelope ? "/envelopes/{0}/recipients?resend_envelope=true" : "/envelopes/{0}/recipients", EnvelopeId);
                req.HttpMethod = "PUT";
                req.IntegratorKey = RestSettings.Instance.IntegratorKey;

                RequestBuilder builder = new RequestBuilder();
                builder.Proxy = Proxy;
                builder.Request = req;

                List<RequestBody> requestBodies = new List<RequestBody>();
                RequestBody rb = new RequestBody();

                rb.Text = JsonConvert.SerializeObject(recipients);
                requestBodies.Add(rb);
                req.RequestBody = requestBodies.ToArray();
                builder.Request = req;
                ResponseInfo response = builder.MakeRESTRequest();
                this.Trace(builder, response);

                if (response.StatusCode != HttpStatusCode.OK)
                {
                    this.ParseErrorResponse(response);
                }

                return response.StatusCode == HttpStatusCode.OK;
            }
            catch (Exception ex)
            {
                if (ex is WebException || ex is NotSupportedException || ex is InvalidOperationException || ex is ProtocolViolationException)
                {
                    // Once we get the debugging logger integrated into this project, we should write a log entry here
                    return false;
                }

                throw;
            }
        }
开发者ID:kvvora,项目名称:DocuSign-.NET-Client,代码行数:55,代码来源:Envelope.cs


示例4: GetEnvelopeMatchingTemplates

        /// <summary>
        /// Get the list of Templates Matched with the envelope
        /// </summary>
        /// <exception cref="ArgumentNullException">If we find a null or empty envelopeId</exception>
        /// <returns>object with information about the envelope's documents</returns>
        public EnvelopeTemplates GetEnvelopeMatchingTemplates()
        {
            try
            {
                RequestBuilder builder = new RequestBuilder();
                RequestInfo req = new RequestInfo();
                List<RequestBody> requestBodies = new List<RequestBody>();

                req.RequestContentType = "application/json";
                req.AcceptContentType = "application/json";
                req.HttpMethod = "GET";
                req.LoginEmail = this.Login.Email;
                req.ApiPassword = this.Login.ApiPassword;
                req.DistributorCode = RestSettings.Instance.DistributorCode;
                req.DistributorPassword = RestSettings.Instance.DistributorPassword;
                req.IntegratorKey = RestSettings.Instance.IntegratorKey;
                req.Uri = string.Format("{0}/envelopes/{1}/templates?include=matching%2Capplied", this.Login.BaseUrl, this.EnvelopeId);

                builder.Request = req;
                builder.Proxy = this.Proxy;

                ResponseInfo response = builder.MakeRESTRequest();
                this.Trace(builder, response);

                if (response.StatusCode != HttpStatusCode.OK)
                {
                    this.ParseErrorResponse(response);
                    return null;
                }
                else
                {
                    return EnvelopeTemplates.FromJson(response.ResponseText);
                }
            }
            catch (Exception ex)
            {
                if (ex is WebException || ex is NotSupportedException || ex is InvalidOperationException || ex is ProtocolViolationException)
                {
                    // Once we get the debugging logger integrated into this project, we should write a log entry here
                    return null;
                }

                throw;
            }
        }
开发者ID:kvvora,项目名称:DocuSign-.NET-Client,代码行数:50,代码来源:Envelope.cs


示例5: CreateWithoutDocument

        /// <summary>
        /// Creates an envelope for the user without a document.
        /// </summary>
        /// <returns>true if successful, false otherwise</returns>
        private bool CreateWithoutDocument()
        {
            try
            {
                RequestInfo req = new RequestInfo();
                req.RequestContentType = "application/json";
                req.AcceptContentType = "application/json";
                req.BaseUrl = this.Login.BaseUrl;
                req.LoginEmail = this.Login.Email;
                req.LoginPassword = this.Login.Password;
                req.ApiPassword = this.Login.ApiPassword;
                req.Uri = "/envelopes?api_password=true";
                req.HttpMethod = "POST";
                req.IntegratorKey = RestSettings.Instance.IntegratorKey;

                RequestBuilder builder = new RequestBuilder();
                builder.Proxy = this.Proxy;
                builder.Request = req;

                List<RequestBody> requestBodies = new List<RequestBody>();
                RequestBody rb = new RequestBody();

                rb.Text = this.CreateJson(new List<string>());

                if (string.IsNullOrEmpty(rb.Text) == true)
                {
                    return false;
                }

                requestBodies.Add(rb);

                req.RequestBody = requestBodies.ToArray();
                builder.Request = req;
                ResponseInfo response = builder.MakeRESTRequest();
                this.Trace(builder, response);

                if (response.StatusCode == HttpStatusCode.Created)
                {
                    this.ParseCreateResponse(response);
                    if (Status == "sent")
                    {
                        GetRecipientView();
                    }
                    else
                    {
                        GetSenderView(string.Empty);
                    }
                }
                else
                {
                    this.ParseErrorResponse(response);
                }
                return response.StatusCode == HttpStatusCode.Created;
            }
            catch (Exception ex)
            {
                if (ex is WebException || ex is NotSupportedException || ex is InvalidOperationException || ex is ProtocolViolationException)
                {
                    // Once we get the debugging logger integrated into this project, we should write a log entry here
                    return false;
                }

                throw;
            }
        }
开发者ID:kvvora,项目名称:DocuSign-.NET-Client,代码行数:69,代码来源:Envelope.cs


示例6: GetAccountsEnvelopes

        /// <summary>
        /// Get envelopes for this user's account
        /// </summary>
        /// <param name="fromDate">start date to find envelopes for this user</param>
        /// <returns>List of envelopes for this account</returns>
        public AccountEnvelopes GetAccountsEnvelopes(DateTime fromDate)
        {
            if (this.Login == null)
            {
                throw new ArgumentNullException("Login");
            }

            if (string.IsNullOrEmpty(this.Login.BaseUrl) == true)
            {
                throw new ArgumentNullException("BaseUrl");
            }

            if (string.IsNullOrEmpty(this.Login.ApiPassword) == true)
            {
                throw new ArgumentNullException("ApiPassword");
            }


            try
            {
                RequestBuilder builder = new RequestBuilder();
                RequestInfo req = new RequestInfo();
                List<RequestBody> requestBodies = new List<RequestBody>();

                req.RequestContentType = "multipart/form-data";
                req.BaseUrl = this.Login.BaseUrl;
                req.LoginEmail = this.Login.Email;
                req.ApiPassword = this.Login.ApiPassword;
                req.Uri = "/envelopes?api_password=true&from_date=" + fromDate.ToString();
                req.HttpMethod = "GET";
                req.IntegratorKey = RestSettings.Instance.IntegratorKey;
                req.IsMultipart = true;
                req.MultipartBoundary = new Guid().ToString();
                builder.Proxy = this.Proxy;


                RequestBody rb = new RequestBody();
                rb.Headers.Add("Content-Type", "application/json");

                requestBodies.Add(rb);

                req.RequestBody = requestBodies.ToArray();
                builder.Request = req;

                ResponseInfo response = builder.MakeRESTRequest();
                this.Trace(builder, response);

                var envs = AccountEnvelopes.FromJson(response.ResponseText);
                return envs;

            }
            catch
            {
                throw;
            }

        }
开发者ID:kvvora,项目名称:DocuSign-.NET-Client,代码行数:62,代码来源:Envelope.cs


示例7: GetSearchFolderCount

        /// <summary>
        /// Gets the number of envelopes in the search folder
        /// </summary>
        /// <param name="folderName"></param>
        /// <param name="fromDate"></param>
        /// <returns></returns>
        public int GetSearchFolderCount(string folderName, DateTime fromDate)
        {
            if (this.Login == null)
            {
                throw new ArgumentNullException("Login");
            }

            if (string.IsNullOrEmpty(this.Login.BaseUrl) == true)
            {
                throw new ArgumentNullException("BaseUrl");
            }

            if (string.IsNullOrEmpty(this.Login.ApiPassword) == true)
            {
                throw new ArgumentNullException("ApiPassword");
            }


            try
            {
                RequestBuilder builder = new RequestBuilder();
                RequestInfo req = new RequestInfo();
                List<RequestBody> requestBodies = new List<RequestBody>();

                req.RequestContentType = "multipart/form-data";
                req.BaseUrl = this.Login.BaseUrl;
                req.LoginEmail = this.Login.Email;
                req.ApiPassword = this.Login.ApiPassword;
                req.Uri = string.Format("/search_folders/{0}?from_date={1}", folderName, fromDate);
                req.HttpMethod = "GET";
                req.IntegratorKey = RestSettings.Instance.IntegratorKey;
                req.IsMultipart = true;
                req.MultipartBoundary = new Guid().ToString();
                builder.Proxy = this.Proxy;


                RequestBody rb = new RequestBody();
                rb.Headers.Add("Content-Type", "application/json");

                requestBodies.Add(rb);

                req.RequestBody = requestBodies.ToArray();
                builder.Request = req;

                ResponseInfo response = builder.MakeRESTRequest();
                this.Trace(builder, response);

                JObject json = JObject.Parse(response.ResponseText);
                return (int)json["totalRows"];

            }
            catch
            {
                throw;
            }
        }
开发者ID:kvvora,项目名称:DocuSign-.NET-Client,代码行数:62,代码来源:Envelope.cs


示例8: UpdateStatus

        /// <summary>
        /// updates the envelope's status to the one provided
        /// </summary>
        /// <param name="voidedReason">voided reason required when status is being updated to voided</param>
        /// <returns>true if successful, false otherwise</returns>
        public bool UpdateStatus(string voidedReason = null)
        {
            try
            {
                RequestBuilder builder = new RequestBuilder();
                RequestInfo req = new RequestInfo();
                List<RequestBody> requestBodies = new List<RequestBody>();

                req.RequestContentType = "application/json";
                req.AcceptContentType = "application/json";
                req.HttpMethod = "PUT";
                req.LoginEmail = this.Login.Email;
                req.ApiPassword = this.Login.ApiPassword;
                req.DistributorCode = RestSettings.Instance.DistributorCode;
                req.DistributorPassword = RestSettings.Instance.DistributorPassword;
                req.IntegratorKey = RestSettings.Instance.IntegratorKey;
                req.Uri = string.Format("{0}/envelopes/{1}", this.Login.BaseUrl, this.EnvelopeId);

                RequestBody rb = new RequestBody();

                StringBuilder sb = new StringBuilder();
                sb.Append("{");
                sb.AppendFormat("\"status\":\"{0}\"", this.Status);

                if (this.Status == "voided") {

                    if (String.IsNullOrEmpty(voidedReason))
                        throw new ArgumentException("The voided reason is required to change status to voided.");

                    sb.AppendFormat(", \"voidedReason\":\"{0}\"", voidedReason);
                }
                    
                sb.Append("}");

                rb.Text = sb.ToString();
                requestBodies.Add(rb);

                req.RequestBody = requestBodies.ToArray();
                builder.Request = req;
                builder.Proxy = this.Proxy;

                ResponseInfo response = builder.MakeRESTRequest();
                this.Trace(builder, response);

                if (response.StatusCode != HttpStatusCode.OK)
                {
                    this.ParseErrorResponse(response);
                    return false;
                }


                return true;

            }
            catch (Exception ex)
            {
                if (ex is WebException || ex is NotSupportedException || ex is InvalidOperationException || ex is ProtocolViolationException)
                {
                    // Once we get the debugging logger integrated into this project, we should write a log entry here
                    return false;
                }

                throw;
            }

        }
开发者ID:kvvora,项目名称:DocuSign-.NET-Client,代码行数:71,代码来源:Envelope.cs


示例9: GetRecipientNames

        /// <summary>
        /// Returns a list of names of the recipients
        /// </summary>
        /// <returns></returns>
        public IEnumerable<string> GetRecipientNames()
        {
            RequestBuilder builder = new RequestBuilder();
            RequestInfo req = new RequestInfo();
            List<RequestBody> requestBodies = new List<RequestBody>();

            req.RequestContentType = "application/json";
            req.AcceptContentType = "application/json";
            req.HttpMethod = "GET";
            req.LoginEmail = this.Login.Email;
            req.ApiPassword = this.Login.ApiPassword;
            req.DistributorCode = RestSettings.Instance.DistributorCode;
            req.DistributorPassword = RestSettings.Instance.DistributorPassword;
            req.IntegratorKey = RestSettings.Instance.IntegratorKey;
            req.Uri = string.Format("{0}/envelopes/{1}/recipients", this.Login.BaseUrl, EnvelopeId);

            builder.Request = req;
            builder.Proxy = this.Proxy;

            ResponseInfo response = builder.MakeRESTRequest();
            this.Trace(builder, response);

            if (response.StatusCode != HttpStatusCode.OK)
            {
                this.ParseErrorResponse(response);
                return null;
            }
            JObject json = JObject.Parse(response.ResponseText);
            var names = new List<string>();
            var signers = json["signers"];
            foreach (var signer in signers)
                names.Add((string)signer["name"]);
            var ccs = json["carbonCopies"];
            foreach (var cc in ccs)
                names.Add((string)cc["name"]);
            var certifiedDeliveries = json["certifiedDeliveries"];
            foreach (var cd in certifiedDeliveries)
                names.Add((string)cd["name"]);
            return names;
        }
开发者ID:kvvora,项目名称:DocuSign-.NET-Client,代码行数:44,代码来源:Envelope.cs


示例10: GetStatus

        /// <summary>
        /// Updates an envelope status
        /// </summary>
        /// <param name="envelopeId">The envelopeId for this envelope</param>
        /// <returns>Date/Time when the status was set</returns>
        public DateTime GetStatus(string envelopeId)
        {
            try
            {
                RequestBuilder builder = new RequestBuilder();
                RequestInfo req = new RequestInfo();
                List<RequestBody> requestBodies = new List<RequestBody>();

                req.RequestContentType = "application/json";
                req.AcceptContentType = "application/json";
                req.HttpMethod = "GET";
                req.LoginEmail = this.Login.Email;
                req.ApiPassword = this.Login.ApiPassword;
                req.DistributorCode = RestSettings.Instance.DistributorCode;
                req.DistributorPassword = RestSettings.Instance.DistributorPassword;
                req.IntegratorKey = RestSettings.Instance.IntegratorKey;
                req.Uri = string.Format("{0}/envelopes/{1}", this.Login.BaseUrl, envelopeId);

                builder.Request = req;
                builder.Proxy = this.Proxy;

                ResponseInfo response = builder.MakeRESTRequest();
                this.Trace(builder, response);

                if (response.StatusCode != HttpStatusCode.OK)
                {
                    this.ParseErrorResponse(response);
                    return DateTime.MinValue;
                }
                JObject json = JObject.Parse(response.ResponseText);

                this.Status = (string)json["status"];
                this.EmailSubject = (string)json["emailSubject"];
                this.EmailBlurb = (string)json["emailBlurb"];
                this.Created = DateTime.Parse((string)json["createdDateTime"]);

                return (DateTime)json["statusChangedDateTime"];

            }
            catch (Exception ex)
            {
                if (ex is WebException || ex is NotSupportedException || ex is InvalidOperationException || ex is ProtocolViolationException)
                {
                    // Once we get the debugging logger integrated into this project, we should write a log entry here
                    return DateTime.MinValue;
                }

                throw;
            }
        }
开发者ID:kvvora,项目名称:DocuSign-.NET-Client,代码行数:55,代码来源:Envelope.cs


示例11: GetDocuments

        /// <summary>
        /// Returns a list of names of documents used to create this envelope
        /// </summary>
        /// <returns></returns>
        public List<EnvelopeDocument> GetDocuments()
        {
            try
            {
                RequestBuilder builder = new RequestBuilder();
                RequestInfo req = new RequestInfo();
                List<RequestBody> requestBodies = new List<RequestBody>();

                req.RequestContentType = "application/json";
                req.AcceptContentType = "application/json";
                req.HttpMethod = "GET";
                req.LoginEmail = this.Login.Email;
                req.ApiPassword = this.Login.ApiPassword;
                req.DistributorCode = RestSettings.Instance.DistributorCode;
                req.DistributorPassword = RestSettings.Instance.DistributorPassword;
                req.IntegratorKey = RestSettings.Instance.IntegratorKey;
                req.Uri = string.Format("{0}/envelopes/{1}/documents", this.Login.BaseUrl, EnvelopeId);

                builder.Request = req;
                builder.Proxy = this.Proxy;

                ResponseInfo response = builder.MakeRESTRequest();
                this.Trace(builder, response);

                if (response.StatusCode != HttpStatusCode.OK)
                {
                    this.ParseErrorResponse(response);
                    return null;
                }
                JObject json = JObject.Parse(response.ResponseText);

                var docs = json["envelopeDocuments"];
                var res = new List<EnvelopeDocument>();
                if (docs != null)
                    foreach (var jsonDoc in docs)
                        if ((string)jsonDoc["type"] == "content")
                            res.Add(new EnvelopeDocument { documentId = (string)jsonDoc["documentId"], name = (string)jsonDoc["name"] });
                return res;
            }
            catch (Exception ex)
            {
                if (ex is WebException || ex is NotSupportedException || ex is InvalidOperationException || ex is ProtocolViolationException)
                {
                    // Once we get the debugging logger integrated into this project, we should write a log entry here
                    return null;
                }

                throw;
            }

        }
开发者ID:kvvora,项目名称:DocuSign-.NET-Client,代码行数:55,代码来源:Envelope.cs


示例12: GetUserConsoleView

        /// <summary>
        /// Logs in to the account based on the credentials provided.
        /// </summary>
        /// <returns>true if successful, false otherwise</returns>
        public bool GetUserConsoleView()
        {
            try
            {
                RequestInfo req = new RequestInfo();
                RequestBuilder utils = new RequestBuilder();

                req.RequestContentType = "application/json";
                req.AcceptContentType = "application/json";
                req.HttpMethod = "POST";
                req.LoginEmail = this.Email;
                req.LoginPassword = string.IsNullOrEmpty(this.ApiPassword) == false ? this.ApiPassword : this.Password;
                req.DistributorCode = RestSettings.Instance.DistributorCode;
                req.DistributorPassword = RestSettings.Instance.DistributorPassword;
                req.IntegratorKey = RestSettings.Instance.IntegratorKey;
                req.Uri = string.Format("{0}/views/console", this.BaseUrl);

                if (string.IsNullOrWhiteSpace(this.SOBOUserId) == false)
                {
                    req.SOBOUserId = this.SOBOUserId;
                    utils.AuthorizationFormat = RequestBuilder.AuthFormat.Json;
                }

                utils.Request = req;
                utils.Proxy = this.Proxy;

                ResponseInfo response = utils.MakeRESTRequest();
                this.Trace(utils, response);

                if (response.StatusCode == HttpStatusCode.OK || response.StatusCode == HttpStatusCode.Created)
                {
                    this.ParseConsoleResponse(response);
                }
                else
                {
                    this.ParseErrorResponse(response);
                }

                return (response.StatusCode == HttpStatusCode.OK || response.StatusCode == HttpStatusCode.Created);
            }
            catch (Exception ex)
            {
                if (ex is WebException || ex is NotSupportedException || ex is InvalidOperationException || ex is ProtocolViolationException)
                {
                    // Once we get the debugging logger integrated into this project, we should write a log entry here
                    return false;
                }

                throw;
            }
        }
开发者ID:kvvora,项目名称:DocuSign-.NET-Client,代码行数:55,代码来源:Account.cs


示例13: BillingPlan

        /// <summary>
        /// Logs in to the account based on the credentials provided.
        /// </summary>
        /// <param name="planId">Plan ID</param>
        /// <returns>Plan object if successful, null otherwise</returns>
        public Plan BillingPlan(string planId)
        {
            try
            {
                RequestInfo req = new RequestInfo();
                RequestBuilder builder = new RequestBuilder();

                req.RequestContentType = "application/json";
                req.AcceptContentType = "application/json";
                req.HttpMethod = "GET";
                req.LoginEmail = this.Email;
                req.LoginPassword = string.IsNullOrEmpty(this.ApiPassword) == false ? this.ApiPassword : this.Password;
                req.DistributorCode = RestSettings.Instance.DistributorCode;
                req.DistributorPassword = RestSettings.Instance.DistributorPassword;
                req.IntegratorKey = RestSettings.Instance.IntegratorKey;
                req.Uri = string.Format("{0}{1}", RestSettings.Instance.WebServiceUrl, string.Format("/billing_plans/{0}", planId));

                builder.Request = req;
                builder.Proxy = this.Proxy;

                ResponseInfo response = builder.MakeRESTRequest();
                this.Trace(builder, response);

                if (response.StatusCode != HttpStatusCode.OK)
                {
                    this.ParseErrorResponse(response);
                }
                else
                {
                    return Plan.FromJson(response.ResponseText);
                }
            }
            catch
            {
            }

            return null;
        }
开发者ID:kvvora,项目名称:DocuSign-.NET-Client,代码行数:43,代码来源:Account.cs


示例14: GetAccountInfo

        /// <summary>
        /// Retreive information about the account
        /// <returns>Collection of objects</returns>
        /// </summary>
        public JObject GetAccountInfo()
        {
            RequestInfo req = new RequestInfo();
            RequestBuilder utils = new RequestBuilder();

            req.RequestContentType = "application/json";
            req.AcceptContentType = "application/json";
            req.HttpMethod = "GET";
            req.LoginEmail = this.Email;
            req.LoginPassword = string.IsNullOrEmpty(this.ApiPassword) == false ? this.ApiPassword : this.Password;
            req.IntegratorKey = RestSettings.Instance.IntegratorKey;
            req.Uri = this.BaseUrl;

            utils.Request = req;
            utils.Proxy = this.Proxy;

            ResponseInfo response = utils.MakeRESTRequest();
            this.Trace(utils, response);

            if (response.StatusCode != HttpStatusCode.OK)
            {
                this.ParseErrorResponse(response);
            }

            JObject json = JObject.Parse(response.ResponseText);
            return json;
        }
开发者ID:kvvora,项目名称:DocuSign-.NET-Client,代码行数:31,代码来源:Account.cs


示例15: AddDocument

        /// <summary>
        /// Add documents to this envelope (must be in draft state)
        /// </summary>
        /// <param name="fileBytes">new file content</param>
        /// <param name="fileName">new file name</param>
        /// <param name="index">Index for the new file</param>
        /// <returns>true if successful, false otherwise</returns>
        public bool AddDocument(List<byte[]> fileBytesList, List<string> fileNames, int index = 1)
        {
            RequestBuilder builder = new RequestBuilder();
            RequestInfo req = new RequestInfo();
            List<RequestBody> requestBodies = new List<RequestBody>();

            req.RequestContentType = "multipart/form-data";
            req.BaseUrl = this.Login.BaseUrl;
            req.LoginEmail = this.Login.Email;
            //req.LoginPassword = this.Login.Password;
            req.ApiPassword = this.Login.ApiPassword;
            req.Uri = "/envelopes/" + EnvelopeId + "/documents";
            req.HttpMethod = "PUT";
            req.IntegratorKey = RestSettings.Instance.IntegratorKey;
            req.IsMultipart = true;
            req.MultipartBoundary = Guid.NewGuid().ToString();
            builder.Proxy = this.Proxy;

            RequestBody rb = new RequestBody();
            rb.Text = this.CreateJson(fileNames, index);
            rb.Headers.Add("Content-Type", "application/json");
            rb.Headers.Add("Content-Disposition", "form-data");
            requestBodies.Add(rb);

            rb = new RequestBody();

            for (int i = 0; i < fileNames.Count; i++)
            {
                var fileName = fileNames[i];
                RequestBody reqFile = new RequestBody();
                string mime = string.IsNullOrEmpty(this.MimeType) == true ? DefaultMimeType : this.MimeType;
                reqFile.Headers.Add("Content-Type", mime);
                reqFile.Headers.Add("Content-Disposition", string.Format("file; filename=\"{0}\"; documentId={1}", fileName, index++));

                reqFile.FileBytes = fileBytesList[i];
                reqFile.SubstituteStrings = false;
                requestBodies.Add(reqFile);
            }

            req.RequestBody = requestBodies.ToArray();
            builder.Request = req;

            ResponseInfo response = builder.MakeRESTRequest();
            this.Trace(builder, response);

            if ((response.StatusCode == HttpStatusCode.OK) && (!response.ResponseText.Contains("FORMAT_CONVERSION_ERROR")))
            {
                this.ParseCreateResponse(response);
                return true;
            }
            else
            {
                this.ParseErrorResponse(response);
                return false;
            }
        }
开发者ID:kvvora,项目名称:DocuSign-.NET-Client,代码行数:63,代码来源:Envelope.cs


示例16: GetFirstRecipients

        /// <summary>
        /// Returns all recipients that have lowest routing value (meaning they need to sign first)
        /// </summary>
        /// <returns></returns>
        public IEnumerable<JToken> GetFirstRecipients()
        {
            try
            {
                RequestBuilder builder = new RequestBuilder();
                RequestInfo req = new RequestInfo();
                List<RequestBody> requestBodies = new List<RequestBody>();

                req.RequestContentType = "application/json";
                req.AcceptContentType = "application/json";
                req.HttpMethod = "GET";
                req.LoginEmail = this.Login.Email;
                req.ApiPassword = this.Login.ApiPassword;
                req.DistributorCode = RestSettings.Instance.DistributorCode;
                req.DistributorPassword = RestSettings.Instance.DistributorPassword;
                req.IntegratorKey = RestSettings.Instance.IntegratorKey;
                req.Uri = string.Format("{0}/envelopes/{1}/recipients", this.Login.BaseUrl, EnvelopeId);

                builder.Request = req;
                builder.Proxy = this.Proxy;

                ResponseInfo response = builder.MakeRESTRequest();
                this.Trace(builder, response);

                if (response.StatusCode != HttpStatusCode.OK)
                {
                    this.ParseErrorResponse(response);
                    return new List<JToken>();
                }
                JObject json = JObject.Parse(response.ResponseText);
                var signers = json["signers"];
                // return the first signer
                if (signers.Count() > 0)
                {
                    int minRoute = signers.Min(s => (int)s["routingOrder"]);

                    return signers.Where(s => (int)s["routingOrder"] == minRoute);
                }
                else
                {
                    return signers;
                }
            }
            catch (Exception ex)
            {
                if (ex is WebException || ex is NotSupportedException || ex is InvalidOperationException || ex is ProtocolViolationException)
                {
                    // Once we get the debugging logger integrated into this project, we should write a log entry here
                    return null;
                }

                throw;
            }
        }
开发者ID:kvvora,项目名称:DocuSign-.NET-Client,代码行数:58,代码来源:Envelope.cs


示例17: RemoveDocument

        /// <summary>
        /// Remove documents from this envelop (must be in draft state)
        /// </summary>
        /// <returns>true if successful, false otherwise</returns>
        public bool RemoveDocument(List<string> docList)
        {
            if (docList == null)
            {
                return false;
            }

            if (docList.Count == 0)
            {
                return true;
            }

            List<Document> docs = new List<Document>();

            foreach (string docId in docList)
            {
                var doc = new Document { documentId = docId };
                docs.Add(doc);
            }

            RequestBuilder builder = new RequestBuilder();
            RequestInfo req = new RequestInfo();
            List<RequestBody> requestBodies = new List<RequestBody>();

            req.RequestContentType = "application/json";
            req.AcceptContentType = "application/json";
            req.BaseUrl = this.Login.BaseUrl;
            req.LoginEmail = this.Login.Email;
            //req.LoginPassword = this.Login.Password;
            req.ApiPassword = this.Login.ApiPassword;
            req.Uri = "/envelopes/" + EnvelopeId + "/documents/";
            req.HttpMethod = "DELETE";
            req.IntegratorKey = RestSettings.Instance.IntegratorKey;
            builder.Proxy = this.Proxy;

            RequestBody rb = new RequestBody();
            EnvelopeCreate env = new EnvelopeCreate();
            env.documents = docs.ToArray();

            JsonSerializerSettings settings = new JsonSerializerSettings();
            settings.NullValueHandling = NullValueHandling.Ignore;
            rb.Text = JsonConvert.SerializeObject(env, settings);
            requestBodies.Add(rb);

            req.RequestBody = requestBodies.ToArray();
            builder.Request = req;

            ResponseInfo response = builder.MakeRESTRequest();
            this.Trace(builder, response);

            return response.StatusCode == HttpStatusCode.OK;
        }
开发者ID:kvvora,项目名称:DocuSign-.NET-Client,代码行数:56,代码来源:Envelope.cs


示例18: Create

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Drawing.Paragraph类代码示例发布时间:2022-05-24
下一篇:
C# Client.RequestBuilder类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap