示例#1
0
        /// <summary>
        /// Creates a new clickwrap version
        /// </summary>
        /// <param name="clickwrapId">The id of clickwrap</param>
        /// <param name="basePath">BasePath for API calls (URI)</param>
        /// <param name="accessToken">Access Token for API call (OAuth)</param>
        /// <param name="accountId">The DocuSign Account ID (GUID or short version) for which the APIs call would be made</param>
        /// <returns>The summary response of a newly created clickwrap version</returns>
        public static ClickwrapVersionSummaryResponse Create(string clickwrapId, string basePath, string accessToken, string accountId, string clickwrapName)
        {
            var apiClient = new ApiClient(basePath);

            apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken);
            var clickAccountApi = new AccountsApi(apiClient);

            var clickwrapRequest = BuildUpdateClickwrapVersionRequest(clickwrapName);

            return(clickAccountApi.CreateClickwrapVersion(accountId, clickwrapId, clickwrapRequest));
        }
示例#2
0
        public ActionResult Create()
        {
            // Step 1. Obtain your OAuth token
            var accessToken = RequestItemsService.User.AccessToken;
            var basePath    = $"{RequestItemsService.Session.BasePath}/clickapi"; // Base API path

            // Step 2: Construct your API headers
            var apiClient = new ApiClient(basePath);

            apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken);
            var clickAccountApi = new AccountsApi(apiClient);

            var accountId = RequestItemsService.Session.AccountId;

            try
            {
                if (string.IsNullOrEmpty(RequestItemsService.ClickwrapId))
                {
                    ViewBag.errorCode    = 400;
                    ViewBag.errorMessage = "Cannot find any clickwrap. Please first create a clickwrap using the first example.";

                    return(View("Error"));
                }

                // Step 3: Construct the request body for your new clickwrap version
                ClickwrapRequest clickwrapRequest = BuildUpdateClickwrapVersionRequest();
                var clickwrapId = RequestItemsService.ClickwrapId;

                // Step 4: Call the Click API to create the clickwrap version
                var clickWrap = clickAccountApi.CreateClickwrapVersion(accountId, clickwrapId, clickwrapRequest);

                //Show results
                ViewBag.h1          = "A new clickwrap version was successfully created";
                ViewBag.message     = $"The new clickwrap version was created! Clickwrap ID: {clickWrap.ClickwrapId}, Name: {clickWrap.ClickwrapName}.";
                ViewBag.Locals.Json = JsonConvert.SerializeObject(clickWrap, Formatting.Indented);

                return(View("example_done"));
            }
            catch (ApiException apiException)
            {
                ViewBag.errorCode    = apiException.ErrorCode;
                ViewBag.errorMessage = apiException.Message;

                return(View("Error"));
            }
        }