/// <summary>
        /// Updates an agreement status
        /// </summary>
        public virtual AgreementStatusUpdateResponse PutStatus(string agreementId, AgreementStatusUpdateInfo info)
        {
            var request = new RestRequest(Method.DELETE);

            request.JsonSerializer = new Serialization.NewtonSoftSerializer();
            request.Resource       = "agreements/{agreementId}";
            request.AddUrlSegment("agreementId", agreementId);
            request.AddJsonBody(info);
            return(this.Sdk.Execute <AgreementStatusUpdateResponse>(request));
        }
        /// <summary>
        /// Cancels an agreement
        /// </summary>
        /// <param name="agreementId">The agreement identifier, as returned by the agreement creation API or retrieved from the API to fetch agreements</param>
        /// <param name="comment">An optional comment describing to the recipient why you want to cancel the transaction</param>
        /// <param name="notifySigner">Whether or not you would like the recipient to be notified that the transaction has been cancelled. The notification is mandatory if any party has already signed this document. The default value is false</param>
        /// <returns>AgreementStatusUpdateResponse</returns>
        public async Task <AgreementStatusUpdateResponse> CancelAgreement(string agreementId, string comment, bool notifySigner)
        {
            AgreementStatusUpdateInfo info = new AgreementStatusUpdateInfo();

            info.value        = "CANCEL";
            info.notifySigner = notifySigner;
            info.comment      = comment;

            string serializedObject = JsonConvert.SerializeObject(info);

            using (HttpContent content = new StringContent(serializedObject))
            {
                content.Headers.Remove("Content-Type");
                content.Headers.Add("Content-Type", "application/json");

                HttpResponseMessage result = await client.PutAsync(apiEndpointVer + "/agreements/" + agreementId + "/status", content)
                                             .ConfigureAwait(false);

                if (result.IsSuccessStatusCode)
                {
                    string response = await result.Content.ReadAsStringAsync().ConfigureAwait(false);

                    AgreementStatusUpdateResponse agreement = JsonConvert.DeserializeObject <AgreementStatusUpdateResponse>(response);

                    return(agreement);
                }
                else
                {
                    string response = await result.Content.ReadAsStringAsync().ConfigureAwait(false);

                    HandleError(result.StatusCode, response, false);

                    return(null);
                }
            }
        }
        /// <summary>
        ///     Cancels an agreement.
        /// </summary>
        /// <param name="accessToken">
        ///     An &lt;a href&#x3D;\&quot;#\&quot; onclick&#x3D;\&quot;this.href&#x3D;oauthDoc()\&quot;
        ///     oncontextmenu&#x3D;\&quot;this.href&#x3D;oauthDoc()\&quot; target&#x3D;\&quot;oauthDoc\&quot;&gt;OAuth Access Token
        ///     &lt;/a&gt; with scopes:&lt;ul&gt;&lt;li style&#x3D;&#39;list-style-type: square&#39;&gt;&lt;a href&#x3D;\&quot;#\
        ///     &quot; onclick&#x3D;\&quot;this.href&#x3D;oauthDoc(&#39;agreement_write&#39;)\&quot; oncontextmenu&#x3D;\&quot;
        ///     this.href&#x3D;oauthDoc(&#39;agreement_write&#39;)\&quot; target&#x3D;\&quot;oauthDoc\&quot;&gt;agreement_write&lt;
        ///     /a&gt;&lt;/li&gt;&lt;/ul&gt;(Legacy clients can use the access token obtained from /auth/tokens endpoint.)
        /// </param>
        /// <param name="agreementId">
        ///     The agreement identifier, as returned by the agreement creation API or retrieved from the API
        ///     to fetch agreements.
        /// </param>
        /// <param name="agreementStatusUpdateInfo">Agreement status update information object.</param>
        /// <returns>AgreementStatusUpdateResponse</returns>
        public AgreementStatusUpdateResponse UpdateStatus(string accessToken, string agreementId, AgreementStatusUpdateInfo agreementStatusUpdateInfo)
        {
            // verify the required parameter 'accessToken' is set
            if (accessToken == null)
            {
                throw new ApiException(400, "Missing required parameter 'accessToken' when calling UpdateStatus");
            }

            // verify the required parameter 'agreementId' is set
            if (agreementId == null)
            {
                throw new ApiException(400, "Missing required parameter 'agreementId' when calling UpdateStatus");
            }

            // verify the required parameter 'agreementStatusUpdateInfo' is set
            if (agreementStatusUpdateInfo == null)
            {
                throw new ApiException(400, "Missing required parameter 'agreementStatusUpdateInfo' when calling UpdateStatus");
            }


            string path = "/agreements/{agreementId}/status";

            path = path.Replace("{format}", "json");
            path = path.Replace("{" + "agreementId" + "}", ApiClient.ParameterToString(agreementId));

            Dictionary <string, string>        queryParams  = new Dictionary <string, string>();
            Dictionary <string, string>        headerParams = new Dictionary <string, string>();
            Dictionary <string, string>        formParams   = new Dictionary <string, string>();
            Dictionary <string, FileParameter> fileParams   = new Dictionary <string, FileParameter>();
            string postBody = null;

            if (accessToken != null)
            {
                headerParams.Add("Access-Token", ApiClient.ParameterToString(accessToken)); // header parameter
            }
            postBody = ApiClient.Serialize(agreementStatusUpdateInfo);                      // http body (model) parameter

            // authentication setting, if any
            string[] authSettings = { };

            // make the HTTP request
            IRestResponse response = (IRestResponse)ApiClient.CallApi(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, authSettings);

            if ((int)response.StatusCode >= 400)
            {
                throw new ApiException((int)response.StatusCode, "Error calling UpdateStatus: " + response.Content, response.Content);
            }
            if ((int)response.StatusCode == 0)
            {
                throw new ApiException((int)response.StatusCode, "Error calling UpdateStatus: " + response.ErrorMessage, response.ErrorMessage);
            }

            return((AgreementStatusUpdateResponse)ApiClient.Deserialize(response.Content, typeof(AgreementStatusUpdateResponse), response.Headers));
        }