static async Task ServerProfilesClient_GetProfileIdsAsync() { try { var client = new LDAPServerProfilesWebApiClient(WebApiBaseUrl, ClientCredentials); LogInfoOfType(client.GetType()); LogInfo($"{nameof(client.GetProfileIdsAsync)}..."); var httpResponse = await client.GetProfileIdsAsync(WebApiRequiresAccessToken); if (!httpResponse.IsSuccessResponse) { client.ThrowClientRequestException("Error al realizar la solicitud", httpResponse); } else { var enumerableDTO = await client.GetEnumerableDTOFromResponseAsync <string>(httpResponse); foreach (var profileId in enumerableDTO) { LogInfo($"ProfileId: {profileId}"); } } } catch (WebApiRequestException ex) { LogWebApiRequestError(ex); } }
static async Task ServerProfilesClient_GetAllAsync() { try { var client = new LDAPServerProfilesWebApiClient(WebApiBaseUrl, ClientCredentials); LogInfoOfType(client.GetType()); LogInfo($"{nameof(client.GetAllAsync)}..."); var httpResponse = await client.GetAllAsync(WebApiRequiresAccessToken); if (!httpResponse.IsSuccessResponse) { client.ThrowClientRequestException("Error al realizar la solicitud", httpResponse); } else { var enumerableDTO = await client.GetEnumerableDTOFromResponseAsync <DTO.LDAPServerProfile>(httpResponse); foreach (var ldapServerProfile in enumerableDTO) { LogInfo($"ProfileId: {ldapServerProfile.ProfileId}"); LogInfo($"Server: {ldapServerProfile.Server}"); LogInfo($"Port: {ldapServerProfile.Port}"); LogInfo($"PortForGlobalCatalog: {ldapServerProfile.PortForGlobalCatalog}"); LogInfo($"BaseDN: {ldapServerProfile.BaseDN}"); LogInfo($"BaseDNforGlobalCatalog: {ldapServerProfile.BaseDNforGlobalCatalog}"); LogInfo($"UseSSL: {ldapServerProfile.UseSSL}"); LogInfo($"UseSSLforGlobalCatalog: {ldapServerProfile.UseSSLforGlobalCatalog}"); LogInfo($"ConnectionTimeout: {ldapServerProfile.ConnectionTimeout}"); LogInfo($"DomainAccountName: {ldapServerProfile.DomainAccountName}"); LogInfo($"DomainAccountPassword: {ldapServerProfile.DomainAccountPassword}"); Console.WriteLine(); } } } catch (WebApiRequestException ex) { LogWebApiRequestError(ex); } }