Skip to content

Commit

Permalink
Merge pull request #1 from Ricorocks-Digital-Agency/fixes
Browse files Browse the repository at this point in the history
Microsoft Adaptive Cards
  • Loading branch information
johnatricorocks authored Feb 27, 2025
2 parents 6e29788 + 0f5aadb commit 28006f1
Show file tree
Hide file tree
Showing 11 changed files with 1,201 additions and 932 deletions.
97 changes: 97 additions & 0 deletions src/Actions/ActionOpenUrl.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?php

namespace NotificationChannels\MicrosoftTeams\Actions;

class ActionOpenUrl
{
/** @var string Property Type */
protected $type = 'Action.OpenUrl';

/** @var string Title of the Action */
protected $title;

/** @var string $mode Mode of the Action. (Primary, Secondary) */
protected $mode;

/** @var string $mode Style of the Action Button. (Positive, Destructive) */
protected $style;

/** @var string $url URL the Action goes to. */
protected $url;

/**
* @return self
*/
public static function create(): self
{
return new self();
}

/**
* Set the title.
*
* @param string $title
*
* @return ActionOpenUrl
*/
public function setTitle(string $title) : self
{
$this->title = $title;
return $this;
}

/**
* Set the mode.
*
* @param string $mode
*
* @return ActionOpenUrl
*/
public function setMode(string $mode) : self
{
$this->mode = $mode;
return $this;
}

/**
* Set the style.
*
* @param string $style
*
* @return ActionOpenUrl
*/
public function setStyle(string $style) : self
{
$this->style = $style;
return $this;
}

/**
* Set the url.
*
* @param string $url
*
* @return ActionOpenUrl
*/
public function setUrl(string $url) : self
{
$this->url = $url;
return $this;
}

/**
* Returns Action properties as an array.
*
* @return array
*/
public function toArray() : array
{
return [
'type' => $this->type,
'title' => $this->title,
'mode' => $this->mode,
'style' => $this->style,
'url' => $this->url
];
}
}
59 changes: 59 additions & 0 deletions src/ContentBlocks/Fact.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php

namespace NotificationChannels\MicrosoftTeams\ContentBlocks;

class Fact
{
/** @var string Fact Title */
protected $title;

/** @var string Fact Value */
protected $value;

/**
* @return self
*/
public static function create(): self
{
return new self();
}

/**
* Set the title.
*
* @param string $title
*
* @return Fact
*/
public function setTitle(string $title) : self
{
$this->title = $title;
return $this;
}

/**
* Set the value.
*
* @param string $value
*
* @return Fact
*/
public function setValue(string $value) : self
{
$this->value = $value;
return $this;
}

/**
* Returns Fact properties as an array.
*
* @return array
*/
public function toArray() : array
{
return [
'title' => $this->title,
'value' => $this->value
];
}
}
86 changes: 86 additions & 0 deletions src/ContentBlocks/FactSet.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?php

namespace NotificationChannels\MicrosoftTeams\ContentBlocks;

class FactSet
{
/** @var string Property Type */
protected $type = 'FactSet';

/** @var string Spacing of the FactSet. (None,Small,Default,Medium,Large,ExtraLarge,Padding) */
protected $spacing;

/** @var array Array of Facts. ([Fact::create()]) */
protected $facts = [];

/** @var bool FactSet Separator. */
protected $separator;

/**
* @return self
*/
public static function create(): self
{
return new self();
}

/**
* Set the spacing.
*
* @param string $spacing
*
* @return FactSet
*/
public function setSpacing(string $spacing) : self
{
$this->spacing = $spacing;
return $this;
}

/**
* Set the separator.
*
* @param bool $separator
*
* @return FactSet
*/
public function setSeparator(bool $separator) : self
{
$this->separator = $separator;
return $this;
}

/**
* Set the facts.
*
* @param array $facts
*
* @return FactSet
*/
public function setFacts(array $facts) : self
{
$this->facts = $facts;
return $this;
}

/**
* Returns FactSet properties as an array.
*
* @return array
*/
public function toArray() : array
{
$facts = [];

foreach($this->facts as $fact) {
$facts[] = $fact->toArray();
}

return [
'type' => $this->type,
'spacing' => $this->spacing,
'facts' => $facts,
'seperator' => $this->separator
];
}
}
149 changes: 149 additions & 0 deletions src/ContentBlocks/Icon.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
<?php

namespace NotificationChannels\MicrosoftTeams\ContentBlocks;

class Icon
{
/** @var string Property Type */
protected $type = 'Icon';

/** @var string Name of the Icon */
protected $name;

/** @var string Spacing of the Icon. (None,Small,Default,Medium,Large,ExtraLarge,Padding) */
protected $spacing;

/** @var bool Icon Separator. */
protected $separator;

/** @var string Horizontal Alignment of Icon. (Left,Center,Right) */
protected $horizontalAlignment;

/** @var string Style of Icon. (Regular,Filled) */
protected $style;

/** @var string Color of Icon. (Default,Dark,Light,Accent,Good,Warning,Attention) */
protected $color;

/** @var string Size of Icon. (xxSmall,xSmall,Small,Standard,Medium,Large,xLarge,xxLarge) */
protected $size;

/**
* @return self
*/
public static function create(): self
{
return new self();
}

/**
* Set the name.
*
* @param string $name
*
* @return Icon
*/
public function setName(string $name) : self
{
$this->name = $name;
return $this;
}

/**
* Set the color.
*
* @param string $color
*
* @return Icon
*/
public function setColor(string $color) : self
{
$this->color = $color;
return $this;
}

/**
* Set the spacing.
*
* @param string $spacing
*
* @return Icon
*/
public function setSpacing(string $spacing) : self
{
$this->spacing = $spacing;
return $this;
}

/**
* Set the seperator.
*
* @param bool $seperator
*
* @return Icon
*/
public function setSeparator(bool $separator) : self
{
$this->separator = $separator;
return $this;
}

/**
* Set the size.
*
* @param string $size
*
* @return Icon
*/
public function setSize(string $size) : self
{
$this->size = $size;
return $this;
}

/**
* Set the style.
*
* @param string $style
*
* @return Icon
*/
public function setStyle(string $style) : self
{
$this->style = $style;
return $this;
}

/**
* Set the horizontal alignment.
*
* @param string $horizontalAlignment
*
* @return Icon
*/
public function setHorizontalAlignment(string $horizontalAlignment) : self
{
$this->horizontalAlignment = $horizontalAlignment;
return $this;
}

/**
* Returns Icon properties as an array.
*
* @return array
*/
public function toArray() : array
{
return [
'type' => $this->type,
'name' => $this->name,
'spacing' => $this->spacing,
'separator' => $this->separator,
'horizontalAlignment' => $this->horizontalAlignment,
'style' => $this->style,
'color' => $this->color,
'size' => $this->size
];
}

}
Loading

0 comments on commit 28006f1

Please sign in to comment.