Skip to content

Commit

Permalink
Little progress in attribute handling for #13
Browse files Browse the repository at this point in the history
  • Loading branch information
gitfvb committed Jul 2, 2024
1 parent 2dbe13d commit 233165b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
38 changes: 21 additions & 17 deletions AptecoPSFramework/plugins/InxmailPro/Public/XPro/Add-Attribute.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,26 @@ function Add-Attribute {

# Create params
$params = [Hashtable]@{
"Object" = "lists"
"Method" = "GET"
#"PageSize" = 100
#"Paging" = $true
"Object" = "attributes"
"Method" = "POST"
"Body" = [PSCustomObject]@{
"name" = $Name.Trim() # Must not be null, Must not contain padding whitespace characters, Size must be between 1 and 255 inclusive
"description" = $Description # Size must be between 0 and 255 inclusive
"type" = "STANDARD"
"senderAddress" = $SenderAddress # Must be a valid email address, Must not be null
}
}

# Add paging
If ( $All -eq $true ) {
$params.Add("Paging", $true)
If ( $SenderName.Length -gt 0 ) {
$params.Body | Add-Member -MemberType NoteProperty -Name "senderName" -Value $SenderName.Trim() # Must not contain padding whitespace characters
}

If ( $ReplyToAddress.Length -gt 0 ) {
$params.Body | Add-Member -MemberType NoteProperty -Name "replyToAddress" -Value $ReplyToAddress # Must be a valid email address
}

If ( $ReplyToName.Length -gt 0 ) {
$params.Body | Add-Member -MemberType NoteProperty -Name "replyToName" -Value $ReplyToName.Trim() # Must not contain padding whitespace characters
}

# add verbose flag, if set
Expand All @@ -35,20 +46,13 @@ function Add-Attribute {
}

# Request lists
$lists = Invoke-XPro @params

# Exclude mailings
If ( $Type.Count -gt 0 ) {
$listsToFilter = $lists."_embedded"."inx:lists" | Where-Object { $_.type -in $type }
} else {
$listsToFilter = $lists."_embedded"."inx:lists"
}
$attribute = Invoke-XPro @params

# return
If ( $IncludeLinks -eq $true ) {
$listsToFilter
$attribute
} else {
$listsToFilter | Select-Object * -ExcludeProperty "_links"
$attribute | Select-Object * -ExcludeProperty "_links"
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ function Get-Attribute {

# Return
switch ($PSCmdlet.ParameterSetName) {

'Single' {

# return
Expand Down

0 comments on commit 233165b

Please sign in to comment.