public override string[] GetAllRoles() { if (!this.Initialized) { return(new string[0]); } try { var roles = RolesApi.GetAllRoles(); if (roles.Count == 0) { return(new string[0]); } foreach (var role in roles) { this.Cache.Roles.Add(role); } return(roles.Select(r => r.Name).ToArray()); } catch (Exception ex) { LogHelper.Error("Operation failed.", this, ex); return(new string[0]); } }
/// <summary> /// Creates a room using specified template /// </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> /// <param name="model">The model of room</param> /// <param name="templateId">The Id of room template</param> /// <returns>The instance of created room</returns> public static Room CreateRoom( string basePath, string accessToken, string accountId, RoomModel model, int templateId) { // Construct your API headers var apiClient = new ApiClient(basePath); apiClient.Configuration.DefaultHeader.Add("Authorization", $"Bearer {accessToken}"); var roomsApi = new RoomsApi(apiClient); var rolesApi = new RolesApi(apiClient); // Obtain Role var clientRole = rolesApi.GetRoles(accountId, new RolesApi.GetRolesOptions { filter = "Default Admin" }).Roles.First(); // Construct the request body for your room var newRoom = BuildRoom(model, clientRole, templateId); // Call the Rooms API to create a room return(roomsApi.CreateRoom(accountId, newRoom)); }
public ActiveDirectoryProcessor(ApiClient apiClient) { _groupsApi = new GroupsApi(apiClient); _rolesApi = new RolesApi(apiClient); _usersApi = new UsersApi(apiClient); _npUserService = new NpUserService(apiClient); _npGroupService = new NpGroupService(apiClient); }
public ActionResult Create(RoomModel model) { // 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 roomsApi = new RoomsApi(apiClient); var rolesApi = new RolesApi(apiClient); var accountId = RequestItemsService.Session.AccountId; // Represents your {ACCOUNT_ID} try { // Step 3: Obtain Role RoleSummary clientRole = rolesApi.GetRoles(accountId, new RolesApi.GetRolesOptions { filter = "Default Admin" }).Roles.First(); // Step 4: Construct the request body for your room RoomForCreate newRoom = BuildRoom(model, clientRole); // Step 5: Call the Rooms API to create a room Room room = roomsApi.CreateRoom(accountId, newRoom); ViewBag.h1 = "The room was successfully created"; ViewBag.message = $"The room was created! Room ID: {room.RoomId}, Name: {room.Name}."; ViewBag.Locals.Json = JsonConvert.SerializeObject(room, Formatting.Indented); return(View("example_done")); } catch (ApiException apiException) { ViewBag.errorCode = apiException.ErrorCode; ViewBag.errorMessage = apiException.Message; return(View("Error")); } }
public RolesApiTests() { instance = new RolesApi(); }
public void Init() { _instance = new RolesApi(NprintingApiClient); _userApiInstance = new UsersApi(NprintingApiClient); }
public void Init() { instance = new RolesApi(); }