Cools Ways to use Advanced Search

Here are some C# binary Powershell commands that I created to do a number of different advanced searches in the NERM.

Core Searches:

using RestSharp;
using SecZetta.Private.Controller;
using SecZetta.Private.Models;
using System;
using System.Collections.Generic;
using System.Management.Automation;
using System.Text;
using System.Text.Json.Serialization;
using System.Text.Json;
using System.Threading.Tasks;
using System.Security.Cryptography.X509Certificates;
using System.Runtime.CompilerServices;
using System.Data;
using System.IO;
using System.Linq;
using System.Globalization;
using CsvHelper;

namespace SecZetta.Public.Views
{
    [Cmdlet(VerbsCommon.Get, "SecZettaManager")]
    [OutputType(typeof(Sponsors))]
    public class GetSecZettaManager : PSCmdlet
    {
        [Parameter()]
        public string EmailAddress { get; set; }
        [Parameter()]
        public SwitchParameter Production { get; set; } = false;

        protected override void BeginProcessing()
        {
            base.BeginProcessing();
        }
        protected override void ProcessRecord()
        {
            SecZettaAdvancedSerach secZettaAdvancedSerach = new SecZettaAdvancedSerach();
            RestResponse restResponse = secZettaAdvancedSerach.SecZettaSearchManager(ManagerEmail: $"{EmailAddress}", Production: Production.ToBool());
            Console.Write($"RestResponse: {restResponse}");

            var options = new JsonSerializerOptions
            {
                PropertyNameCaseInsensitive = true,
                NumberHandling = JsonNumberHandling.AllowReadingFromString,
                IncludeFields = true,
                DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull

            };

            Sponsors sponsorObject = JsonSerializer.Deserialize<Sponsors>(restResponse.Content, options);
            WriteObject(sponsorObject);
        }
        protected override void EndProcessing()
        {
            base.EndProcessing();
        }
    }

    [Cmdlet(VerbsCommon.Get, "SecZettaNonEmployee")]
    [OutputType(typeof(SecZettaUserProfiles))]
    public class GetSecZettaNonEmployee : PSCmdlet
    {
        [Parameter()]
        public string EmailAddress { get; set; }
        [Parameter()]
        public string Last4SSN { get; set; }
        [Parameter()]
        public SwitchParameter Production { get; set; } = false;

        protected override void BeginProcessing()
        {
            base.BeginProcessing();
        }
        protected override void ProcessRecord()
        {
            SecZettaAdvancedSerach secZettaAdvancedSerach = new SecZettaAdvancedSerach();
            Console.WriteLine("Running search");
            RestResponse restResponse = secZettaAdvancedSerach.SecZettaSearchUser(UserEmail: EmailAddress, Last4SSN: Last4SSN, Production: Production.ToBool());

            var options = new JsonSerializerOptions
            {
                PropertyNameCaseInsensitive = true,
                NumberHandling = JsonNumberHandling.AllowReadingFromString,
                IncludeFields = true,
                DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull

            };

            SecZettaUserProfiles nonEmployeeObject = JsonSerializer.Deserialize<SecZettaUserProfiles>(restResponse.Content, options);
            WriteObject(nonEmployeeObject);
            //WriteObject(restResponse);
        }
        protected override void EndProcessing()
        {
            base.EndProcessing();
        }
    }

    [Cmdlet(VerbsCommon.Get, "SecZettaLocation")]
    [OutputType(typeof(SecZettaLocationProfileModels))]
    public class GetSecZettaLocation : PSCmdlet
    {
        [Parameter()]
        public string LocationName { get; set; }
        [Parameter()]
        public SwitchParameter Production { get; set; } = false;

        protected override void BeginProcessing()
        {
            base.BeginProcessing();
        }
        protected override void ProcessRecord()
        {
            SecZettaAdvancedSerach secZettaAdvancedSerach = new SecZettaAdvancedSerach();
            RestResponse restResponse = secZettaAdvancedSerach.SecZettaSearchLocation(LocationName: LocationName, Production: Production.ToBool());

            var options = new JsonSerializerOptions
            {
                PropertyNameCaseInsensitive = true,
                NumberHandling = JsonNumberHandling.AllowReadingFromString,
                IncludeFields = true,
                DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull

            };

            SecZettaLocationProfileModels locationObject = JsonSerializer.Deserialize<SecZettaLocationProfileModels>(restResponse.Content, options);
            WriteObject(locationObject);
            //WriteObject(restResponse);
        }
        protected override void EndProcessing()
        {
            base.EndProcessing();
        }
    }

    [Cmdlet(VerbsCommon.Get, "SecZettaOrganzation")]
    [OutputType(typeof(SecZettaOrganizationProfiles))]
    public class GetSecZettaOrganzation : PSCmdlet
    {
        [Parameter()]
        public string OrganizationName { get; set; }
        [Parameter()]
        public SwitchParameter Production { get; set; } = false;

        protected override void BeginProcessing()
        {
            base.BeginProcessing();
        }
        protected override void ProcessRecord()
        {
            SecZettaAdvancedSerach secZettaAdvancedSerach = new SecZettaAdvancedSerach();
            RestResponse restResponse = secZettaAdvancedSerach.SecZettaSearchOrganization(OrganizationName: OrganizationName, Production: Production.ToBool());

            var options = new JsonSerializerOptions
            {
                PropertyNameCaseInsensitive = true,
                NumberHandling = JsonNumberHandling.AllowReadingFromString,
                IncludeFields = true,
                DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull

            };

            SecZettaOrganizationProfiles organizationObject = JsonSerializer.Deserialize<SecZettaOrganizationProfiles>(restResponse.Content, options);
            WriteObject(organizationObject);
            //WriteObject(restResponse);
        }
        protected override void EndProcessing()
        {
            base.EndProcessing();
        }
    }

    [Cmdlet(VerbsCommon.Get, "SecZettaSubPopulation")]
    [OutputType(typeof(SecZettaSubPopulationProfileModels))]
    public class GetSecZettaSubPopulation : PSCmdlet
    {
        [Parameter()]
        public string SubPopulationName { get; set; }
        [Parameter()]
        public SwitchParameter Production { get; set; } = false;

        protected override void BeginProcessing()
        {
            base.BeginProcessing();
        }
        protected override void ProcessRecord()
        {
            SecZettaAdvancedSerach secZettaAdvancedSerach = new SecZettaAdvancedSerach();
            RestResponse restResponse = secZettaAdvancedSerach.SecZettaSearchSubPopulation(SubPopulationName: SubPopulationName, Production: Production.ToBool());

            var options = new JsonSerializerOptions
            {
                PropertyNameCaseInsensitive = true,
                NumberHandling = JsonNumberHandling.AllowReadingFromString,
                IncludeFields = true,
                DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull

            };

            SecZettaSubPopulationProfiles subPopulationObject = JsonSerializer.Deserialize<SecZettaSubPopulationProfiles>(restResponse.Content, options);
            WriteObject(subPopulationObject);
        }
        protected override void EndProcessing()
        {
            base.EndProcessing();
        }
    }

    [Cmdlet(VerbsCommon.Get, "SecZettaPopulation")]
    [OutputType(typeof(SecZettaSubPopulationProfileModels))]
    public class GetSecZettaPopulation : PSCmdlet
    {
        [Parameter()]
        public string PopulationName { get; set; }
        [Parameter()]
        public SwitchParameter Production { get; set; } = false;

        protected override void BeginProcessing()
        {
            base.BeginProcessing();
        }
        protected override void ProcessRecord()
        {
            SecZettaAdvancedSerach secZettaAdvancedSerach = new SecZettaAdvancedSerach();
            RestResponse restResponse = secZettaAdvancedSerach.SecZettaSearchPopulation(PopulationName: PopulationName, Production: Production.ToBool());

            var options = new JsonSerializerOptions
            {
                PropertyNameCaseInsensitive = true,
                NumberHandling = JsonNumberHandling.AllowReadingFromString,
                IncludeFields = true,
                DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull

            };

            SecZettaSubPopulationProfiles populationObject = JsonSerializer.Deserialize<SecZettaSubPopulationProfiles>(restResponse.Content, options);
            WriteObject(populationObject);
        }
        protected override void EndProcessing()
        {
            base.EndProcessing();
        }
    }
}

Classes:

using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json.Serialization;

namespace SecZetta.Private.Models
{
    public class SecZettaAdvancedSearchModels
    {
    }
    public class AvancedSearch
    {
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("advanced_search")]
        public ConditionRulesAttributes Advanced_Serach { get; set; }
    }
    public class ConditionRulesAttributes
    {
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("condition_rules_attributes")]
        public List<RuleAttributes> Condition_RulesAttributes { get; set; }
    }
    public class RuleAttributes
    {
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("type")]
        public string Type { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("condition_object_id")]
        public string ConditionObjectId { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("object_type")]
        public string ObjectType { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("comparison_operator")]
        public string ComparisonOperator { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("value")]
        public string Value { get; set; }
    }
    public class ProfileTypeRule
    {
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("type")]
        public string Type { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("comparison_operator")]
        public string ComparisonOperator { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("value")]
        public string Value { get; set; }
    }
}

using CsvHelper.Configuration.Attributes;
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace SecZetta
{
    public class SecZettaAssignmentProfile
    {
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("id")]
        public string Id { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("uid")]
        public string Uid { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("name")]
        public string Name {get; set;}
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("profile_type_id")]
        public string ProfileTypeId {get; set;}
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("status")]
        public string Status {get; set;}
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("id_proofing_status")]
        public string IdProofingStatus {get; set;}
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("attributes")]
        public SecZettaAssignmentAttribute Attributes {get; set;} 
    }

    public class SecZettaAssignmentAttribute
    {
        [Name("assignment_population")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("assignment_pop_name_ne_attribute")]
        public string AssingnmentPopNameNeAttribute {get; set;}
        [Name("department_ne_attribute")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("department_ne_attribute")]
        public string DepartmentNeAttribute {get; set;}
        [Name("engagement_start_date")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("engagement_start_date")]
        public string EngagmentStartDate {get; set;}
        [Name("personal_first_name")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("personal_first_name")]
        public string PersonalFirstName {get; set;}
        [Name("assignment_location_id_ne_attribute")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("assignment_location_id_ne_attribute")]
        public string AssignmentLocationIdNeAttribute {get; set;}
        [Name("personal_email")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("engagement_non_employee")]
        public string EngagmentNonEmployee {get; set;}
        [Name("personal_email")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("personal_email")]
        public string PersonalEmail {get; set;}
        [Name("assignment_subpopulation_name")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("assignment_subpopulation_name")]
        public string AssignmentSubpopulationName {get; set;}
        [Name("personal_last_name")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("personal_last_name")]
        public string PersonalLastName {get; set;}
        [Name("assignment_population")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("assignment_population")]
        public string AssignmentPopulation {get; set;}
        [Name("assignment_organization_name_ne_attribute")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("organization_for_assignment_ne_attribute")]
        public string OrganizationForAssignmentNeAttribute {get; set;}
        [Name("assignment_organization_name_ne_attribute")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("assignment_organization_name_ne_attribute")]
        public string AssignmentOrganizationNameNeAttrinute {get; set;}
        [Name("engagement_end_date")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("engagement_end_date")]
        public string EngagementEndDate {get; set;}
        [Name("assignment_subpopulation_name")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("assignment_sub_population")]
        public string AssignmentSubPopulation {get; set;}
        [Name("Personal_manager")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("manager_ne_attribute")]
        public string ManagerNeAttribute {get; set;}
        [Name("assignment_facility_id_ne_attribute")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("assignment_facility_id_ne_attribute")]
        public string AssignmentFacilityIdNeAttribute {get; set;}
        [Name("last_4_ssn_ne_attribute")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("last_4_ssn_ne_attribute")]
        public string Last4SSN { get; set; }
    }

    public class SecZettaPayload 
    {
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("profile")]
        public SecZettaAssignmentProfile Profile {get; set;}
    }
}

using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json.Serialization;
using RestSharp;

namespace SecZetta.Private.Models
{
    public class SecZettaCollaboratorProfileModels
    {
        [JsonPropertyName("profile")]
        public CollaboratorProfile Profile { get; set; }
    }
    public class CollaboratorProfile
    {
        [JsonPropertyName("name")]
        public string Name { get; set; }
        [JsonPropertyName("profile_type_id")]
        public string ProfileTypeId { get; set; }
        [JsonPropertyName("status")]
        public string Status { get; set; }
        [JsonPropertyName("id_proofing_status")]
        public string IdProofingStatus { get; set; }
        [JsonPropertyName("attributes")]
        public CollaboratorAttribute Attributes { get; set; }

    }
    public class CollaboratorAttribute 
    {
        [JsonPropertyName("professional_email")]
        public string ProfessionalEmail { get; set; }
        [JsonPropertyName("new_professional_phone_number")]
        public string ProfessionalPhoneNumber { get; set; }
        [JsonPropertyName("day_of_birth_ne_attribute")]
        public string DayOfBrith { get; set; }
        [JsonPropertyName("new_personal_phone_number")]
        public string PersonalPhoneNumber { get; set; }
        [JsonPropertyName("personal_first_name")]
        public string PersonalFirstName { get; set; }
        [JsonPropertyName("preferred_name_ne_attribute")]
        public string PreferredName { get; set; }
        [JsonPropertyName("last_4_ssn_ne_attribute")]
        public string Last4SSN { get; set; }
        [JsonPropertyName("personal_email")]
        public string PersonalEmail { get; set; }
        [JsonPropertyName("personal_last_name")]
        public string PersonalLastName { get; set; }
        [JsonPropertyName("birth_month_ne_attribute")]
        public string MonthOfBrith { get; set; }
        [JsonPropertyName("assignment_organization")]
        public string AssignmentOrganization { get; set; }
        [JsonPropertyName("personal_middle_name")]
        public string PersonalMiddleName { get; set; }
        [JsonPropertyName("suffix_ne_attribute")]
        public string Suffix { get; set; }
    }
}

using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json.Serialization;
using RestSharp;

namespace SecZetta.Private.Models
{
    public class SecZettaLocationProfileModels
    {
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("profiles")]
        public List<SecZettaLocationProfile> Profiles { get; set; }
    }
    public class SecZettaLocationProfileModel
    {
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("profile")]
        public SecZettaLocationProfile Profile { get; set; }
    }
    public class SecZettaLocationProfile
    {
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("id")]
        public string Id { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("uid")]
        public string Uid { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("name")]
        public string Name { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("profile_type_id")]
        public string ProfileTypeId { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("status")]
        public string Status { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("id_proofing_status")]
        public string IdProofingStatus { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("attributes")]
        public SecZettaLocationAttribute Attributes { get;  set; }
    }
    public class SecZettaLocationAttribute
    {
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("location_code_ne_attribute")]
        public string LocationCode { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("location_id_ne_attribute")]
        public string LocationId { get; set; }
    }
}

using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json.Serialization;

namespace SecZetta.Private.Models
{
    public class SecZettaNEAttributeModels
    {
    }

    public class NEAttributeOprion
    {
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("ne_attribute_id")]
        public string NeAttributeId { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("option")]
        public string Option { get; set; }
    }

    public class NewNEAttributeOprions
    {
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("ne_attribute_options")]
        public List<NEAttributeOprion> NEAttributeOprions { get; set; }
    }
}

using System;
using System.Collections.Generic;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Text.Json.Serialization;

namespace SecZetta.Private.Models
{
    public class SecZettaOrganizationProfileModels
    {
        [JsonPropertyName("profile")]
        public SecZettaOraganizationProfile Profile { get; set; }
    }
    public class SecZettaOrganizationProfiles
    {
        [JsonPropertyName("profiles")]
        public List<SecZettaOraganizationProfile> Profiles { get; set; }
    }
    public class SecZettaOraganizationProfile
    {
        [JsonPropertyName("id")]
        public string Id { get; set; }
        [JsonPropertyName("uid")]
        public string Uid { get; set; }
        [JsonPropertyName("name")]
        public string Name { get; set; }
        [JsonPropertyName("profile_type_id")]
        public string ProfileTypeId { get; set; }
        [JsonPropertyName("status")]
        public string Status { get; set; }
        [JsonPropertyName("id_proofing_status")]
        public string IdProofingStatus { get; set; }
        [JsonPropertyName("attributes")]
        public SecZettaOraganizationAttribute Attributes { get; set;}
    }
    public class SecZettaOraganizationAttribute 
    {
        [JsonPropertyName("personal_state_or_province")]
        public string PersonalStateOrProvince { get; set; }
        [JsonPropertyName("personal_country")]
        public string PersonalCountry { get; set; }
        [JsonPropertyName("facility_id_ne_attribute")]
        public string FacilityId { get; set; }
        [JsonPropertyName("organization_population_ne_attribute")]
        public string OrganizationPopulation { get; set; }
        [JsonPropertyName("ssm_sponsor_con_ne_attribute")]
        public string SSMSponsor { get; set; }
        [JsonPropertyName("organization_name_ne_attribute")]
        public string OrganizationName { get; set; }
        [JsonPropertyName("organization_collaborators_ne_attribute")]
        public string OrganizationCollaborator { get; set; }
        [JsonPropertyName("personal_city")]
        public string PersonalCity { get; set; }
        [JsonPropertyName("personal_street")]
        public string PersonalStreet { get; set; }
        [JsonPropertyName("personal_zip")]
        public string PersonalZip { get; set; }
    }
}

using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json.Serialization;

namespace SecZetta.Private.Models
{
    public class SecZettaSponserUserAccountModels
    {
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("user")]
        public SecZettaSponserUser User { get; set; }
    }
    public class SecZettaSponserUser 
    {
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("type")]
        public string Type { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("name")]
        public string Name { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("email")]
        public string Email { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("title")]
        public string Title { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("status")]
        public string Status { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("login")]
        public string Login { get; set; }
    }

    public class SecZettaSponsorUserAccount 
    {
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("display_name")]
        public string DisplayName { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("email_address")]
        public string EmailAddress { get; set; }
    }
    public class Sponsors
    {
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("users")]
        public List<SponsorAttributes> Users { get; set; }
    }
    public class SponsorAttributes
    {
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("id")]
        public string Id { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("uid")]
        public string Uid { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("type")]
        public string Type { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("name")]
        public string Name { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("email")]
        public string Email { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("title")]
        public string Title { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("status")]
        public string Status { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("login")]
        public string Login { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("last_login")]
        public string LastLogin { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("cookies_accepted_at")]
        public string CookiesAcceptedAt { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("preferred_language")]
        public string PreferredLanguage { get; set; }
    }
}

using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json.Serialization;

namespace SecZetta.Private.Models
{
    public class SecZettaStateLicenseProfileModels
    {
        [JsonPropertyName("profile")]
        public SecZettaStateLicenseProfile Profile { get; set; }
    }
    public class SecZettaStateLicenseProfile 
    {
        [JsonPropertyName("name")]
        public string Name { get; set; }
        [JsonPropertyName("profile_type_id")]
        public string ProfileTypeId { get; set; }
        [JsonPropertyName("status")]
        public string Status { get; set; }
        [JsonPropertyName("id_proofing_status")]
        public string IdProofingStatus { get; set; }
        [JsonPropertyName("attributes")]
        public SecZettaStatLicenseAttribute Attributes { get; set; }
    }
    public class SecZettaStatLicenseAttribute 
    {
        [JsonPropertyName("license_non_employee_ne_attribute")]
        public string LicesnseNonEmployee { get; set; }
        [JsonPropertyName("state_license_ne_attribute")]
        public string StateLicense { get; set; }
        [JsonPropertyName("state_license_expiration_ne_attribute")]
        public string StateLicenseExpiration { get; set; }
        [JsonPropertyName("state_license_number_ne_attribute")]
        public string StateLicenseNumber { get; set; }

        [JsonPropertyName("license_state_of_issuance")]
        public string StateOfInssuance { get; set; }
    }
}

using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json.Serialization;

namespace SecZetta.Private.Models
{
    
    public class SecZettaSubPopulationProfileModels
    {
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("profile")]
        public SecZettaSubPopulationProfile Profile { get; set; }
    }
    public class SecZettaSubPopulationProfiles
    {
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("profiles")]
        public List<SecZettaSubPopulationProfile> Profiles { get; set; }
    }
    public class SecZettaSubPopulationProfile 
    {
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("id")]
        public string Id { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("uid")]
        public string Uuid { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("name")]
        public string Name { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("profile_type_id")]
        public string ProfileTypeId { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("status")]
        public string Status { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("id_proofing_status")]
        public string IdProofingStatus { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("attributes")]
        public SecZettaSubPopulationAttribute Attributes { get; set; }

    }
    public class SecZettaSubPopulationAttribute 
    {
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("meta_profile_creation_date")]
        public string MetaProfileCreationDate { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("subpop_population_ne_attribute")]
        public string SubPopulation { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("sub_population_name_ne_attribute")]
        public string SubPopulationName { get; set; }
    }
}

using CsvHelper.Configuration.Attributes;
using System;
using System.Collections.Generic;
using System.Management.Automation;
using System.Text;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;

namespace SecZetta.Private.Models
{
    public class SecZettaUserProfiles
    {
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("profiles")]
        public List<SecZettaUserProfile> Profiles { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("_metadata")]
        public Metadata Metadata { get; set; }
    }
    public class SecZettaUserProfileSingle
    {
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("profile")]
        public SecZettaUserProfile Profiles { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("_metadata")]
        public Metadata Metadata { get; set; }
    }
    public class SecZettaUserProfile 
    {
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("id")]
        public string Id { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("uid")]
        public string Uid { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("name")]
        public string Name { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("profile_type_id")]
        public string ProfileTypeId { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("status")]
        public string Status { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("id_proofing_status")]
        public string IdProofingStatus { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("attributes")]
        public SecZettaUserAttribute Attributes { get; set; }
    }
    public class SecZettaUserAttribute 
    {
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("professional_email")]
        public string ProfessionalEmail { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("new_professional_phone_number")]
        public string ProfessionalPhoneNumber { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("day_of_birth_ne_attribute")]
        [ValidateSet("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31")]
        public string DayOfBirth { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("personal_country")]
        public string PersonalCountry { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("new_personal_phone_number")]
        public string PersonalPhoneNumber { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("personal_first_name")]
        public string PersonalFirstName { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("preferred_name_ne_attribute")]
        public string PreferredName { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("last_4_ssn_ne_attribute")]
        [ValidatePattern("\\d{4}")]
        public string Last4SSN { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("personal_email")]
        public string PersonalEmail { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("personal_last_name")]
        public string PersonalLastName { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("birth_month_ne_attribute")]
        [ValidateSet("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12")]
        public string MonthOfBirth { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("personal_middle_name")]
        public string PersonalMiddleName { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("suffix_ne_attribute")]
        public string Suffix { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("npi_ne_attribute")]
        public string NPI { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("do_not_auto_provision_ne_button_attribute")]
        public string DoNotAutoProvisionNeButtonAttribute { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("home_state_dropdown_ne_attribute")]
        public string HomeStateDropDownNeAttribute { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("home_street_address_ne_attribute")]
        public string HomeStreeAddressNeAttribute { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("birth_year_ne_attribute")]
        public string BirthYearNeAttribute { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("home_city_ne_attribute")]
        public string HomeCityNeAttribute { get; set; }
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("home_zip_ne_attribute")]
        public string HomeZipNeAttribute { get; set; }
    }

    public class NonEmployeeSearch 
    { 
    
    }
    public class AllNonEmployeeSearch
    {

    }
    public class Metadata 
    {
        [JsonPropertyName("limit")]
        public long Limit { get; set; }
        [JsonPropertyName("next")]
        public string Next { get; set; }
        [JsonPropertyName("offset")]
        public int Offset { get; set; }
        [JsonPropertyName("total")]
        public long Total { get; set; }
    }

    public class CSVTeplate
    {
        [Name("personal_first_name")]
        public string FirstName { get; set; }
        [Name("personal_middle_name")]
        public string PersonalMiddleName { get; set; }
        [Name("personal_last_name")]
        public string PersonalLastName { get; set; }
        [Name("suffix_ne_attribute")]
        public string Suffix { get; set; }
        [Name("preferred_name_ne_attribute")]
        public string PreferredName { get; set; }
        [Name("birth_month_ne_attribute")]
        public string MonthOfBirth { get; set; }
        [Name("day_of_birth_ne_attribute")]
        public string DayOfBirth { get; set; }
        [Name("birth_year_ne_attribute")]
        public string YearOfBirth { get; set; }
        [Name("last_4_ssn_ne_attribute")]
        public string Last4SSN { get; set; }
        [Name("professional_phone_number")]
        public string professionalPhoneNumer { get; set; }
        [Name("personal_home_phone")]
        public string PersonalHomePhone { get; set; }
        [Name("personal_email")]
        public string PersonalEmail { get; set; }
        [Name("personal_country")]
        public string Country { get; set; }
        [Name("npi_ne_attribute")]
        public string NPINumber { get; set; }
        [Name("assignment_organization_name_ne_attribute")]
        public string AssignmentOrgaizationName { get; set; }
        [Name("assignment_population")]
        public string Population { get; set; }
        [Name("assignment_subpopulation_name")]
        public string SubPopulation { get; set; }
        [Name("assignment_location_id_ne_attribute")]
        public string AssignmentLocationId { get; set; }
        [Name("department_ne_attribute")]
        public string Department { get; set; }
        [Name("manager_ne_attribute")]
        public string Manager { get; set; }
        [Name("engagement_start_date")]
        public string EngagmentStartDate { get; set; }
        [Name("engagement_end_date")]
        public string EngagementEndDate { get; set; }
        [Name("access_enddate")]
        public string AccessEndDate { get; set; }
        [Name("Personal_manager")]
        public string PersonalManager { get; set; }
        [Name("assignment_facility_id_ne_attribute")]
        public string FacilityId { get; set; }
        [Name("home_city_ne_attribute")]
        public string HomeCity {get; set;}
        [Name("home_state_dropdown_ne_attribute")]
        public string HomeState {get; set;}
        [Name("home_street_address_ne_attribute")]
        public string HomeStreet   { get; set; }
        [Name("home_zip_ne_attribute")]
        public string HomeZip { get; set; }
    }

   
}

6 Likes

Hi @mpotti,

Thank you for sharing it with the community!

Can you share an example of how to load this into PowerShell to utilize it?

I know of 2 ways to use this and load it into powershell. 1. Use .Net cmd line tool to build a new solution. 2. Use Visual Studio to create a new project and build the solution that way. When completed you will end up with a .dll file that you can then use the Import-Module cmdlet to import the project. Here is an example how to use the the command line. No special software to be installed if you are on windows.

Use this method you are unable to install the dotnet cmdline.(Advanced)

Use this method if you are able to install the dotnet cmdline tool. (Easy)
Here is an example of how to create a solution using the dotnet cmdline tool.

You will also need to install the needed nuget packages:
RestSharp
CSVHelper
Microsoft.Bcl.AsyncInterfaces
Microsoft.Bcl.HashCode
System.Text.Json

Please let me know if you have any other questions or would like more code examples. Always happy to share. I want to eventually create a github repo for this and make it a public project where the information is way more general I just have not gotten that far yet. I will update with a link once I have had a chance to do so.