-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
138 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
namespace Formapro\TelegramBot; | ||
|
||
use function Formapro\Values\get_value; | ||
|
||
/** | ||
* @see https://core.telegram.org/bots/api#document | ||
*/ | ||
class Document | ||
{ | ||
private $values = []; | ||
|
||
public function getFileId(): string | ||
{ | ||
return get_value($this, 'file_id'); | ||
} | ||
|
||
public function getFileName(): ?string | ||
{ | ||
return get_value($this, 'file_name'); | ||
} | ||
|
||
public function getFileSize(): ?int | ||
{ | ||
return get_value($this, 'file_size'); | ||
} | ||
|
||
public function getMimeType(): ?string | ||
{ | ||
return get_value($this, 'mime_type'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,39 @@ | ||
<?php | ||
namespace Formapro\TelegramBot; | ||
|
||
use function Formapro\Values\get_value; | ||
|
||
/** | ||
* @see https://core.telegram.org/bots/api#sending-files | ||
* @see https://core.telegram.org/bots/api#file | ||
*/ | ||
interface File | ||
class File | ||
{ | ||
private $values = []; | ||
|
||
private $fileUrl; | ||
|
||
public function getFileId(): string | ||
{ | ||
return get_value($this, 'file_id'); | ||
} | ||
|
||
public function getFileSize(): ?int | ||
{ | ||
return get_value($this, 'file_size'); | ||
} | ||
|
||
public function getFilePath(): ?string | ||
{ | ||
return get_value($this, 'file_path'); | ||
} | ||
|
||
public function setFileUrl(?string $fileUrl): void | ||
{ | ||
$this->fileUrl = $fileUrl; | ||
} | ||
|
||
public function getFileUrl(): ?string | ||
{ | ||
return $this->fileUrl; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace Formapro\TelegramBot; | ||
|
||
use function Formapro\Values\get_value; | ||
use function Formapro\Values\get_values; | ||
use function Formapro\Values\set_value; | ||
|
||
/** | ||
* @see https://core.telegram.org/bots/api#getfile | ||
*/ | ||
class GetFile | ||
{ | ||
private $values = []; | ||
|
||
public function __construct(string $fileId) | ||
{ | ||
set_value($this, 'file_id', $fileId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters