public void CreateBrandTest()
        {
            Brand brand = new Brand();

            brand.BrandCompany = "Walker Engineering, Inc.";
            brand.BrandName    = "WEI";
            string accountId = "8290264" /* developer */;
            var    response  = instance.CreateBrand(accountId, brand);

            NUnit.Framework.Assert.IsInstanceOf <BrandsResponse>(response, "response is BrandsResponse");
        }
Beispiel #2
0
        public IActionResult Create(string brandName, string defaultBrandLanguage)
        {
            // Check the token with minimal buffer time.
            bool tokenOk = CheckToken(3);

            if (!tokenOk)
            {
                // We could store the parameters of the requested operation so it could be
                // restarted automatically. But since it should be rare to have a token issue
                // here, we'll make the user re-enter the form data after authentication.
                RequestItemsService.EgName = EgName;
                return(Redirect("/ds/mustAuthenticate"));
            }

            // Data for this method
            // signerEmail
            // signerName
            var basePath = RequestItemsService.Session.BasePath + "/restapi";

            // Step 1. Obtain your OAuth token
            var accessToken = RequestItemsService.User.AccessToken;  // Represents your {ACCESS_TOKEN}
            var accountId   = RequestItemsService.Session.AccountId; // Represents your {ACCOUNT_ID}

            // Step 2. Construct your API headers
            var config = new Configuration(new ApiClient(basePath));

            config.AddDefaultHeader("Authorization", "Bearer " + accessToken);

            // Step 3. Construct your request body
            Brand newBrand = new Brand
            {
                BrandName            = brandName,
                DefaultBrandLanguage = defaultBrandLanguage
            };

            try
            {
                // Step 4. Call the eSignature REST API
                AccountsApi accountsApi = new AccountsApi(config);
                var         results     = accountsApi.CreateBrand(accountId, newBrand);
                ViewBag.h1      = "New brand created";
                ViewBag.message = "The brand has been created!<br />Brand ID:" + results.Brands[0].BrandId + ".";
            }
            catch (ApiException apiException)
            {
                ViewBag.errorCode    = apiException.ErrorCode;
                ViewBag.errorMessage = apiException.Message;
                return(View("Error"));
            }

            return(View("example_done"));
        }
        private void CreateBrand_CorrectAccountIdAndBrand_ReturnBrandsResponse()
        {
            var brand = new Brand
            {
                BrandName = "C# Brand"
            };

            BrandsResponse brands = _accountsApi.CreateBrand(_testConfig.AccountId, brand);

            foreach (Brand singleBrand in brands.Brands)
            {
                if (singleBrand.BrandName == brand.BrandName)
                {
                    _testConfig.BrandId = singleBrand.BrandId;
                }
            }
        }
        private void CreateBrandTest()
        {
            AccountsApi accApi = new AccountsApi();
            Brand       brand  = new Brand
            {
                BrandName = "C# Brand"
            };

            var brands = accApi.CreateBrand(testConfig.AccountId, brand);

            foreach (var brnds in brands.Brands)
            {
                if (brnds.BrandName == brand.BrandName)
                {
                    testConfig.BrandId = brnds.BrandId;
                }
            }
        }
        /// <summary>
        /// Creates a brand
        /// </summary>
        /// <param name="brandName">The name of new brand</param>
        /// <param name="defaultBrandLanguage">Default brand's language</param>
        /// <param name="accessToken">Access Token for API call (OAuth)</param>
        /// <param name="basePath">BasePath for API calls (URI)</param>
        /// <param name="accountId">The DocuSign Account ID (GUID or short version) for which the APIs call would be made</param>
        /// <returns>A brand</returns>
        public static BrandsResponse Create(string brandName, string defaultBrandLanguage, string accessToken, string basePath, string accountId)
        {
            // Construct your API headers
            var apiClient = new ApiClient(basePath);

            apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken);

            // Construct your request body
            Brand newBrand = new Brand
            {
                BrandName            = brandName,
                DefaultBrandLanguage = defaultBrandLanguage
            };

            // Call the eSignature REST API
            AccountsApi accountsApi = new AccountsApi(apiClient);

            return(accountsApi.CreateBrand(accountId, newBrand));
        }