Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit57c793d

Browse files
committed
[Notifier] Add options to Microsoft Teams notifier
1 parentcfb1016 commit57c793d

File tree

35 files changed

+2062
-4
lines changed

35 files changed

+2062
-4
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespaceSymfony\Component\Notifier\Bridge\MicrosoftTeams\Action;
13+
14+
useSymfony\Component\Notifier\Bridge\MicrosoftTeams\Action\Input\InputInterface;
15+
16+
/**
17+
* @author Edouard Lescot <edouard.lescot@gmail.com>
18+
* @author Oskar Stark <oskarstark@googlemail.com>
19+
*
20+
* @see https://docs.microsoft.com/en-us/outlook/actionable-messages/message-card-reference#actioncard-action
21+
*/
22+
finalclass ActionCardimplements ActionInterface
23+
{
24+
protected$options = ['@type' =>'ActionCard'];
25+
26+
publicfunctionname(string$name):self
27+
{
28+
$this->options['name'] =$name;
29+
30+
return$this;
31+
}
32+
33+
publicfunctioninput(InputInterface$inputAction):self
34+
{
35+
$this->options['inputs'][] =$inputAction->toArray();
36+
37+
return$this;
38+
}
39+
40+
publicfunctionaction(ActionCardCompatibleActionInterface$action):self
41+
{
42+
$this->options['actions'][] =$action->toArray();
43+
44+
return$this;
45+
}
46+
47+
publicfunctiontoArray():array
48+
{
49+
return$this->options;
50+
}
51+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespaceSymfony\Component\Notifier\Bridge\MicrosoftTeams\Action;
13+
14+
/**
15+
* An Action which can be used inside an ActionCard.
16+
*
17+
* @author Oskar Stark <oskarstark@googlemail.com>
18+
*/
19+
interface ActionCardCompatibleActionInterfaceextends ActionInterface
20+
{
21+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespaceSymfony\Component\Notifier\Bridge\MicrosoftTeams\Action;
13+
14+
/**
15+
* @author Edouard Lescot <edouard.lescot@gmail.com>
16+
* @author Oskar Stark <oskarstark@googlemail.com>
17+
*/
18+
interface ActionInterface
19+
{
20+
publicfunctiontoArray():array;
21+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespaceSymfony\Component\Notifier\Bridge\MicrosoftTeams\Action\Element;
13+
14+
/**
15+
* @author Edouard Lescot <edouard.lescot@gmail.com>
16+
* @author Oskar Stark <oskarstark@googlemail.com>
17+
*
18+
* @see https://docs.microsoft.com/en-us/outlook/actionable-messages/message-card-reference#header
19+
*/
20+
finalclass Header
21+
{
22+
protected$options = [];
23+
24+
publicfunctionname(string$name):self
25+
{
26+
$this->options['name'] =$name;
27+
28+
return$this;
29+
}
30+
31+
publicfunctionvalue(string$value):self
32+
{
33+
$this->options['value'] =$value;
34+
35+
return$this;
36+
}
37+
38+
publicfunctiontoArray():array
39+
{
40+
return$this->options;
41+
}
42+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespaceSymfony\Component\Notifier\Bridge\MicrosoftTeams\Action;
13+
14+
useSymfony\Component\Notifier\Bridge\MicrosoftTeams\Action\Element\Header;
15+
16+
/**
17+
* @author Edouard Lescot <edouard.lescot@gmail.com>
18+
* @author Oskar Stark <oskarstark@googlemail.com>
19+
*
20+
* @see https://docs.microsoft.com/en-us/outlook/actionable-messages/message-card-reference#httppost-action
21+
*/
22+
finalclass HttpPostActionimplements ActionCardCompatibleActionInterface
23+
{
24+
protected$options = ['@type' =>'HttpPOST'];
25+
26+
publicfunctionname(string$name):self
27+
{
28+
$this->options['name'] =$name;
29+
30+
return$this;
31+
}
32+
33+
publicfunctiontarget(string$url):self
34+
{
35+
$this->options['target'] =$url;
36+
37+
return$this;
38+
}
39+
40+
publicfunctionheader(Header$header):self
41+
{
42+
$this->options['headers'][] =$header->toArray();
43+
44+
return$this;
45+
}
46+
47+
publicfunctionbody(string$body):self
48+
{
49+
$this->options['body'] =$body;
50+
51+
return$this;
52+
}
53+
54+
publicfunctionbodyContentType(string$contentType):self
55+
{
56+
$this->options['bodyContentType'] =$contentType;
57+
58+
return$this;
59+
}
60+
61+
publicfunctiontoArray():array
62+
{
63+
return$this->options;
64+
}
65+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespaceSymfony\Component\Notifier\Bridge\MicrosoftTeams\Action\Input;
13+
14+
/**
15+
* @author Edouard Lescot <edouard.lescot@gmail.com>
16+
* @author Oskar Stark <oskarstark@googlemail.com>
17+
*/
18+
abstractclass AbstractInputimplements InputInterface
19+
{
20+
protected$options = [];
21+
22+
publicfunctionid(string$id):self
23+
{
24+
$this->options['id'] =$id;
25+
26+
return$this;
27+
}
28+
29+
publicfunctionisRequired(bool$required):self
30+
{
31+
$this->options['isRequired'] =$required;
32+
33+
return$this;
34+
}
35+
36+
publicfunctiontitle(string$title):self
37+
{
38+
$this->options['title'] =$title;
39+
40+
return$this;
41+
}
42+
43+
publicfunctionvalue(string$value):self
44+
{
45+
$this->options['value'] =$value;
46+
47+
return$this;
48+
}
49+
50+
publicfunctiontoArray():array
51+
{
52+
return$this->options;
53+
}
54+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespaceSymfony\Component\Notifier\Bridge\MicrosoftTeams\Action\Input;
13+
14+
/**
15+
* @author Edouard Lescot <edouard.lescot@gmail.com>
16+
* @author Oskar Stark <oskarstark@googlemail.com>
17+
*
18+
* @see https://docs.microsoft.com/en-us/outlook/actionable-messages/message-card-reference#dateinput
19+
*/
20+
finalclass DateInputextends AbstractInput
21+
{
22+
publicfunctionincludeTime(bool$includeTime):self
23+
{
24+
$this->options['includeTime'] =$includeTime;
25+
26+
return$this;
27+
}
28+
29+
publicfunctiontoArray():array
30+
{
31+
$this->options['@type'] ='DateInput';
32+
33+
returnparent::toArray();
34+
}
35+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespaceSymfony\Component\Notifier\Bridge\MicrosoftTeams\Action\Input;
13+
14+
/**
15+
* @author Edouard Lescot <edouard.lescot@gmail.com>
16+
* @author Oskar Stark <oskarstark@googlemail.com>
17+
*/
18+
interface InputInterface
19+
{
20+
publicfunctiontoArray():array;
21+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespaceSymfony\Component\Notifier\Bridge\MicrosoftTeams\Action\Input;
13+
14+
useSymfony\Component\Notifier\Exception\InvalidArgumentException;
15+
16+
/**
17+
* @author Edouard Lescot <edouard.lescot@gmail.com>
18+
* @author Oskar Stark <oskarstark@googlemail.com>
19+
*
20+
* @see https://docs.microsoft.com/en-us/outlook/actionable-messages/message-card-reference#multichoiceinput
21+
*/
22+
finalclass MultiChoiceInputextends AbstractInput
23+
{
24+
privateconstSTYLES = [
25+
'expanded',
26+
'normal',
27+
];
28+
29+
publicfunctionchoice(string$display,string$value):self
30+
{
31+
$this->options['choices'][] = ['display' =>$display,'value' =>$value];
32+
33+
return$this;
34+
}
35+
36+
publicfunctionisMultiSelect(bool$multiSelect):self
37+
{
38+
$this->options['isMultiSelect'] =$multiSelect;
39+
40+
return$this;
41+
}
42+
43+
publicfunctionstyle(string$style):self
44+
{
45+
if (!\in_array($style,self::STYLES)) {
46+
thrownewInvalidArgumentException(sprintf('Supported styles for "%s" method are: "%s".',__METHOD__,implode('", "',self::STYLES)));
47+
}
48+
49+
$this->options['style'] =$style;
50+
51+
return$this;
52+
}
53+
54+
publicfunctiontoArray():array
55+
{
56+
$this->options['@type'] ='MultichoiceInput';
57+
58+
returnparent::toArray();
59+
}
60+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp