Skip to content

Commit

Permalink
Implementing list functions for emarsys in #10
Browse files Browse the repository at this point in the history
  • Loading branch information
gitfvb committed Jun 18, 2024
1 parent 231c00b commit f52cc6c
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 2 deletions.
40 changes: 40 additions & 0 deletions AptecoPSFramework/plugins/emarsys/Public/emarsys/Get-List.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

function Get-List {
[CmdletBinding()]
param (
#[Parameter(Mandatory=$false)][Hashtable] $InputHashtable
#[Parameter(Mandatory=$false)][Switch] $DebugMode = $false
#[Parameter(Mandatory=$true)][Int] $ListId

)

begin {

Invoke-EmarsysLogin

}

process {

#| Out-GridView -PassThru | Select -first 20
# $fields | Out-GridView
# #$fields | Export-Csv -Path ".\fields.csv" -Encoding Default -NoTypeInformation -Delimiter "`t"
# #$fields | Select @{name="field_id";expression={ $_.id }}, @{name="fieldname";expression={$_.name}} -ExpandProperty choices | Export-Csv -Path ".\fields_choices.csv" -Encoding Default -NoTypeInformation -Delimiter "`t"

# $c = Invoke-emarsys -cred $cred -uri "$( $settings.base )field/translate/de" -method Get

$emarsys = $Script:variableCache.emarsys

$lists = $emarsys.getLists()

$lists

}

end {

}

}


Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ function Get-ListContacts {
param (
#[Parameter(Mandatory=$false)][Hashtable] $InputHashtable
#[Parameter(Mandatory=$false)][Switch] $DebugMode = $false
[Parameter(Mandatory=$true)][Int] $ListId

)

begin {
Expand All @@ -27,7 +29,7 @@ function Get-ListContacts {

$emarsys = $Script:variableCache.emarsys

$fetch = $emarsys.fetchListContacts("31000652")
$fetch = $emarsys.fetchListContacts([String]$ListId)

$fetch

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ function Get-ListCount {
param (
#[Parameter(Mandatory=$false)][Hashtable] $InputHashtable
#[Parameter(Mandatory=$false)][Switch] $DebugMode = $false
[Parameter(Mandatory=$true)][Int] $ListId

)

begin {
Expand All @@ -27,7 +29,7 @@ function Get-ListCount {

$emarsys = $Script:variableCache.emarsys

$count = $emarsys.countList(31000652)
$count = $emarsys.countList($ListId)

$count

Expand Down

0 comments on commit f52cc6c

Please sign in to comment.