public override IActionResult Get()
        {
            // Step 1. Obtain your OAuth token
            var accessToken = RequestItemsService.User.AccessToken;                      // Represents your {ACCESS_TOKEN}
            var basePath    = $"{RequestItemsService.Session.RoomsApiBasePath}/restapi"; // Base API path

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

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

            var accountId = RequestItemsService.Session.AccountId; // Represents your {ACCOUNT_ID}

            try
            {    //Step 3: Get Templates
                var templates = roomTemplatesApi.GetRoomTemplates(accountId);

                RoomModel = new RoomModel {
                    Templates = templates.RoomTemplates
                };

                return(View("Eg02", this));
            }
            catch (ApiException apiException)
            {
                ViewBag.errorCode    = apiException.ErrorCode;
                ViewBag.errorMessage = apiException.Message;
                return(View("Error"));
            }
        }
Beispiel #2
0
        /// <summary>
        /// Gets the list of room temlates
        /// </summary>
        /// <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 list of room templates</returns>
        public static RoomTemplatesSummaryList GetTemplates(
            string basePath,
            string accessToken,
            string accountId)
        {
            // Construct your API headers
            var apiClient = new ApiClient(basePath);

            apiClient.Configuration.DefaultHeader.Add("Authorization", $"Bearer {accessToken}");
            var roomTemplatesApi = new RoomTemplatesApi(apiClient);

            // Call the Rooms API to create a room
            return(roomTemplatesApi.GetRoomTemplates(accountId));
        }