Skip to content

Commit

Permalink
wip Telegram
Browse files Browse the repository at this point in the history
  • Loading branch information
guanguans committed Jan 23, 2024
1 parent 10ac670 commit c51766e
Show file tree
Hide file tree
Showing 18 changed files with 579 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Telegram/Client.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

declare(strict_types=1);

/**
* This file is part of the guanguans/notify.
*
* (c) guanguans <[email protected]>
*
* This source file is subject to the MIT license that is bundled.
*/

namespace Guanguans\Notify\Telegram;

class Client extends \Guanguans\Notify\Foundation\Client
{
}
19 changes: 19 additions & 0 deletions src/Telegram/Credential.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

/**
* This file is part of the guanguans/notify.
*
* (c) guanguans <[email protected]>
*
* This source file is subject to the MIT license that is bundled.
*/

namespace Guanguans\Notify\Telegram;

use Guanguans\Notify\Foundation\UriTemplateTokenCredential;

class Credential extends UriTemplateTokenCredential
{
}
36 changes: 36 additions & 0 deletions src/Telegram/Messages/AnimationMessage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

declare(strict_types=1);

/**
* This file is part of the guanguans/notify.
*
* (c) guanguans <[email protected]>
*
* This source file is subject to the MIT license that is bundled.
*/

namespace Guanguans\Notify\Telegram\Messages;

class AnimationMessage extends Message
{
/**
* @var string[]
*/
protected $defined = [
'chat_id',
'animation',
'duration',
'width',
'height',
'thumb',
'caption',
'parse_mode',
'caption_entities',
'disable_notification',
'protect_content',
'reply_to_message_id',
'allow_sending_without_reply',
'reply_markup',
];
}
36 changes: 36 additions & 0 deletions src/Telegram/Messages/AudioMessage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

declare(strict_types=1);

/**
* This file is part of the guanguans/notify.
*
* (c) guanguans <[email protected]>
*
* This source file is subject to the MIT license that is bundled.
*/

namespace Guanguans\Notify\Telegram\Messages;

class AudioMessage extends Message
{
/**
* @var string[]
*/
protected $defined = [
'chat_id',
'audio',
'caption',
'parse_mode',
'caption_entities',
'duration',
'performer',
'title',
'thumb',
'disable_notification',
'protect_content',
'reply_to_message_id',
'allow_sending_without_reply',
'reply_markup',
];
}
24 changes: 24 additions & 0 deletions src/Telegram/Messages/ChatActionMessage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

/**
* This file is part of the guanguans/notify.
*
* (c) guanguans <[email protected]>
*
* This source file is subject to the MIT license that is bundled.
*/

namespace Guanguans\Notify\Telegram\Messages;

class ChatActionMessage extends Message
{
/**
* @var string[]
*/
protected $defined = [
'chat_id',
'action',
];
}
32 changes: 32 additions & 0 deletions src/Telegram/Messages/ContactMessage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

/**
* This file is part of the guanguans/notify.
*
* (c) guanguans <[email protected]>
*
* This source file is subject to the MIT license that is bundled.
*/

namespace Guanguans\Notify\Telegram\Messages;

class ContactMessage extends Message
{
/**
* @var string[]
*/
protected $defined = [
'chat_id',
'phone_number',
'first_name',
'last_name',
'vcard',
'disable_notification',
'protect_content',
'reply_to_message_id',
'allow_sending_without_reply',
'reply_markup',
];
}
29 changes: 29 additions & 0 deletions src/Telegram/Messages/DiceMessage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

declare(strict_types=1);

/**
* This file is part of the guanguans/notify.
*
* (c) guanguans <[email protected]>
*
* This source file is subject to the MIT license that is bundled.
*/

namespace Guanguans\Notify\Telegram\Messages;

class DiceMessage extends Message
{
/**
* @var string[]
*/
protected $defined = [
'chat_id',
'emoji',
'disable_notification',
'protect_content',
'reply_to_message_id',
'allow_sending_without_reply',
'reply_markup',
];
}
34 changes: 34 additions & 0 deletions src/Telegram/Messages/DocumentMessage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

declare(strict_types=1);

/**
* This file is part of the guanguans/notify.
*
* (c) guanguans <[email protected]>
*
* This source file is subject to the MIT license that is bundled.
*/

namespace Guanguans\Notify\Telegram\Messages;

class DocumentMessage extends Message
{
/**
* @var string[]
*/
protected $defined = [
'chat_id',
'document',
'thumb',
'caption',
'parse_mode',
'caption_entities',
'disable_content_type_detection',
'disable_notification',
'protect_content',
'reply_to_message_id',
'allow_sending_without_reply',
'reply_markup',
];
}
34 changes: 34 additions & 0 deletions src/Telegram/Messages/LocationMessage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

declare(strict_types=1);

/**
* This file is part of the guanguans/notify.
*
* (c) guanguans <[email protected]>
*
* This source file is subject to the MIT license that is bundled.
*/

namespace Guanguans\Notify\Telegram\Messages;

class LocationMessage extends Message
{
/**
* @var string[]
*/
protected $defined = [
'chat_id',
'latitude',
'longitude',
'horizontal_accuracy',
'live_period',
'heading',
'proximity_alert_radius',
'disable_notification',
'protect_content',
'reply_to_message_id',
'allow_sending_without_reply',
'reply_markup',
];
}
28 changes: 28 additions & 0 deletions src/Telegram/Messages/MediaGroupMessage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

/**
* This file is part of the guanguans/notify.
*
* (c) guanguans <[email protected]>
*
* This source file is subject to the MIT license that is bundled.
*/

namespace Guanguans\Notify\Telegram\Messages;

class MediaGroupMessage extends Message
{
/**
* @var string[]
*/
protected $defined = [
'chat_id',
'media',
'disable_notification',
'protect_content',
'reply_to_message_id',
'allow_sending_without_reply',
];
}
28 changes: 28 additions & 0 deletions src/Telegram/Messages/Message.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

/**
* This file is part of the guanguans/notify.
*
* (c) guanguans <[email protected]>
*
* This source file is subject to the MIT license that is bundled.
*/

namespace Guanguans\Notify\Telegram\Messages;

use Guanguans\Notify\Foundation\Concerns\AsJson;
use Guanguans\Notify\Foundation\Concerns\AsPost;
use Guanguans\Notify\Telegram\Credential;

class Message extends \Guanguans\Notify\Foundation\Message
{
use AsPost;
use AsJson;

public function httpUri()
{
return sprintf('https://api.telegram.org/bot%s/sendMessage', Credential::TEMPLATE_TOKEN);
}
}
33 changes: 33 additions & 0 deletions src/Telegram/Messages/PhotoMessage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

declare(strict_types=1);

/**
* This file is part of the guanguans/notify.
*
* (c) guanguans <[email protected]>
*
* This source file is subject to the MIT license that is bundled.
*/

namespace Guanguans\Notify\Telegram\Messages;

class PhotoMessage extends Message
{
/**
* @var string[]
*/
protected $defined = [
'chat_id',
'photo',
'caption',
'parse_mode',
'caption_entities',
'disable_web_page_preview',
'disable_notification',
'protect_content',
'reply_to_message_id',
'allow_sending_without_reply',
'reply_markup',
];
}
Loading

0 comments on commit c51766e

Please sign in to comment.