Skip to content

Commit

Permalink
Examples + Some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
PrzemyslawKlys committed Dec 22, 2019
1 parent fe1ea0a commit 6f46546
Show file tree
Hide file tree
Showing 11 changed files with 124 additions and 8 deletions.
21 changes: 18 additions & 3 deletions Examples/Example-Advanced1.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,22 @@ Send-TeamsMessage -Verbose {
New-TeamsBigImage -Link "https://evotec.pl/wp-content/uploads//2015/05/Logo-evotec-012.png"
New-TeamsBigImage -Link "https://upload.wikimedia.org/wikipedia/commons/thumb/4/49/Seattle_monorail01_2008-02-25.jpg/1024px-Seattle_monorail01_2008-02-25.jpg"
} -Text 'This is long text that will be added below Big Images. If there would be no big image... it would be just this text.'

#New-TeamsSection -ActivityTitle "**Mark Knopfler**" -ActivitySubtitle "@MarkKnopfler - 9/12/2016 at 1:12pm" -ActivityImageLink "https://pbs.twimg.com/profile_images/1042367841117384704/YvrqQiBK_400x400.jpg" -ActivityText "Mark Knopfler features on B.B King's all-star album of Blues greats, released on this day in 2005..."
#New-TeamsSection -StartGroup -ActivityTitle "**Elon Musk**" -ActivitySubtitle "@elonmusk - 9/12/2016 at 5:33pm" -ActivityImageLink "https://pbs.twimg.com/profile_images/782474226020200448/zDo-gAo0.jpg" -ActivityText "Climate change explained in comic book form by xkcd xkcd.com/1732"
New-TeamsSection {
ActivityTitle -Title "**Elon Musk**"
ActivitySubtitle -Subtitle "@elonmusk - 9/12/2016 at 5:33pm"
ActivityImageLink -Link "https://pbs.twimg.com/profile_images/782474226020200448/zDo-gAo0.jpg"
ActivityText -Text "Climate change explained in comic book form by xkcd xkcd.com/1732"
}
New-TeamsSection {
ActivityTitle -Title "**Mark Knopfler**"
ActivitySubtitle -Subtitle "@MarkKnopfler - 9/12/2016 at 1:12pm"
ActivityImageLink -Link "https://pbs.twimg.com/profile_images/1042367841117384704/YvrqQiBK_400x400.jpg"
ActivityText -Text "Mark Knopfler features on B.B King's all-star album of Blues greats, released on this day in 2005..."
}
New-TeamsSection {
ActivityTitle -Title "**Elon Musk**"
ActivitySubtitle -Subtitle "@elonmusk - 9/12/2016 at 5:33pm"
ActivityImageLink -Link "https://pbs.twimg.com/profile_images/782474226020200448/zDo-gAo0.jpg"
ActivityText -Text "Climate change explained in comic book form by xkcd xkcd.com/1732"
}
} -Uri $TeamsID -Color DarkSeaGreen -MessageSummary 'Tweet'
6 changes: 3 additions & 3 deletions Examples/Example-Advanced2.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Send-TeamsMessage -Verbose -Color DimGray {
New-TeamsFact -Name 'Bold' -Value '**Special GPO**'
New-TeamsFact -Name 'Italic and Bold' -Value '***Other values***'
New-TeamsFact -Name 'Italic' -Value '*2010-10-10*'
} #-ActivityTitle "**Przemyslaw Klys**" #-ActivitySubtitle "@przemyslawklys - 9/12/2016 at 5:33pm" -ActivityImageLink "https://github.com/EvotecIT/PSTeams/blob/master/Images/10.png?raw=true" -ActivityText "Climate change explained in comic book form by xkcd xkcd.com/1732" `
}
New-TeamsSection -Title 'This is 2nd section within 1 message' {
New-TeamsFact -Name 'Bold' -Value '**Special GPO**'
New-TeamsFact -Name 'Italic and Bold' -Value '***Other values***'
Expand Down Expand Up @@ -47,5 +47,5 @@ Send-TeamsMessage -Verbose -Color DimGray {
New-TeamsListItem -Text 'Another entry' -Level 0 -Numbered
New-TeamsListItem -Text 'Very very long line that I want to show, hellow helow. Very very long line that I want to show, hellow helow. ' -Level 0 -Numbered
}
} -Uri $TeamsID -MessageSummary 'Test1' #-MessageText 'Test2' -MessageTitle 'Test1' #
}
}
} -Uri $TeamsID -MessageSummary 'Test1' #-MessageText 'Test2' -MessageTitle 'Test1' #
8 changes: 8 additions & 0 deletions Examples/Example-Bug.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Send-TeamsMessage -Verbose -Color DimGray {
New-TeamsSection -Title 'This is 2nd section within 1 message' {
New-TeamsList -Name 'Testing List' {
New-TeamsListItem -Text 'First ordered list item' -Level 0
New-TeamsListItem -Text 'Another item' -Level 0 -Numbered
}
}
} -Uri $TeamsID -MessageSummary 'Test1' #-MessageText 'Test2' -MessageTitle 'Test1' #
1 change: 1 addition & 0 deletions Examples/Example-Short.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Send-TeamsMessage -URI $TeamsID -MessageText "This text will show up"
20 changes: 20 additions & 0 deletions Examples/Example-TweetLike3.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Send-TeamsMessage -Verbose {
New-TeamsSection {
ActivityTitle -Title "**Elon Musk**"
ActivitySubtitle -Subtitle "@elonmusk - 9/12/2016 at 5:33pm"
ActivityImageLink -Link "https://pbs.twimg.com/profile_images/782474226020200448/zDo-gAo0.jpg"
ActivityText -Text "Climate change explained in comic book form by xkcd xkcd.com/1732"
}
New-TeamsSection {
ActivityTitle -Title "**Mark Knopfler**"
ActivitySubtitle -Subtitle "@MarkKnopfler - 9/12/2016 at 1:12pm"
ActivityImageLink -Link "https://pbs.twimg.com/profile_images/1042367841117384704/YvrqQiBK_400x400.jpg"
ActivityText -Text "Mark Knopfler features on B.B King's all-star album of Blues greats, released on this day in 2005..."
}
New-TeamsSection {
ActivityTitle -Title "**Elon Musk**"
ActivitySubtitle -Subtitle "@elonmusk - 9/12/2016 at 5:33pm"
ActivityImageLink -Link "https://pbs.twimg.com/profile_images/782474226020200448/zDo-gAo0.jpg"
ActivityText -Text "Climate change explained in comic book form by xkcd xkcd.com/1732"
}
} -Uri $TeamsID -Color DarkSeaGreen -MessageSummary 'Tweet'
10 changes: 8 additions & 2 deletions PSTeams.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@
# NestedModules = @()

# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = 'New-TeamsBigImage', 'New-TeamsButton', 'New-TeamsFact',
FunctionsToExport = 'New-TeamsActivityImage', 'New-TeamsActivitySubtitle',
'New-TeamsActivityText', 'New-TeamsActivityTitle',
'New-TeamsBigImage', 'New-TeamsButton', 'New-TeamsFact',
'New-TeamsImage', 'New-TeamsList', 'New-TeamsListItem',
'New-TeamsSection', 'Send-TeamsMessage', 'Send-TeamsMessageBody'

Expand All @@ -80,7 +82,11 @@
# VariablesToExport = @()

# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
AliasesToExport = 'TeamsBigImage', 'TeamsButton', 'TeamsFact', 'TeamsImage', 'TeamsList',
AliasesToExport = 'ActivityImageLink', 'TeamsActivityImageLink',
'New-TeamsActivityImageLink', 'ActivityImage', 'TeamsActivityImage',
'ActivitySubtitle', 'TeamsActivitySubtitle', 'ActivityText',
'TeamsActivityText', 'ActivityTitle', 'TeamsActivityTitle',
'TeamsBigImage', 'TeamsButton', 'TeamsFact', 'TeamsImage', 'TeamsList',
'TeamsListItem', 'TeamsSection', 'TeamsMessage', 'TeamsMessageBody'

# DSC resources to export from this module
Expand Down
22 changes: 22 additions & 0 deletions Public/New-TeamsActivityImage.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
function New-TeamsActivityImage {
[CmdletBinding()]
[alias('ActivityImageLink', 'TeamsActivityImageLink', 'New-TeamsActivityImageLink', 'ActivityImage', 'TeamsActivityImage')]
param(
[string][ValidateSet('Alert', 'Cancel', 'Disable', 'Download', 'Minus', 'Check', 'Add', 'None')] $Image,
[string] $Link
)
if ($Image) {
if ($Image -ne 'None') {
$StoredImages = [IO.Path]::Combine("$(Split-Path -Path $PSScriptRoot -Parent)", "Images")
@{
ActivityImageLink = Get-Image -PathToImages $StoredImages -FileName $Image -FileExtension '.jpg' # -Verbose
type = 'ActivityImage'
}
}
} else {
@{
ActivityImageLink = $Link
Type = 'ActivityImageLink'
}
}
}
11 changes: 11 additions & 0 deletions Public/New-TeamsActivitySubtitle.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function New-TeamsActivitySubtitle {
[CmdletBinding()]
[alias('ActivitySubtitle', 'TeamsActivitySubtitle')]
param(
[string] $Subtitle
)
@{
ActivitySubtitle = $Subtitle
Type = 'ActivitySubtitle'
}
}
12 changes: 12 additions & 0 deletions Public/New-TeamsActivityTItle.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function New-TeamsActivityTitle {
[CmdletBinding()]
[alias('ActivityTitle', 'TeamsActivityTitle')]
param(
[string] $Title
)
@{
ActivityTitle = $Title
Type = 'ActivityTitle'
}

}
11 changes: 11 additions & 0 deletions Public/New-TeamsActivityText.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function New-TeamsActivityText {
[CmdletBinding()]
[alias('ActivityText','TeamsActivityText')]
param(
[string] $Text
)
@{
ActivityText = $Text
Type = 'ActivityText'
}
}
10 changes: 10 additions & 0 deletions Public/New-TeamsSection.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ function New-TeamsSection {
$ImagesList.Add($_)
} elseif ($_.Type -eq 'HeroImageWorkaround') {
$ImageHeroList.Add($_)
} elseif ($_.Type -eq 'ActivityTitle') {
$ActivityTitle = $_.ActivityTitle
} elseif ($_.Type -eq 'ActivitySubtitle') {
$ActivitySubtitle = $_.ActivitySubtitle
} elseif ($_.Type -eq 'ActivityImageLink') {
$ActivityImageLink = $_.ActivityImageLink
} elseif ($_.Type -eq 'ActivityText') {
$ActivityText = $_.ActivityText
} elseif ($_.Type -eq 'ActivityImage') {
$ActivityImageLink = $_.ActivityImageLink
}
}
}
Expand Down

0 comments on commit 6f46546

Please sign in to comment.