Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
TelegramBot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
TelegramBot
Commits
6e7024df
Unverified
Commit
6e7024df
authored
Jun 11, 2017
by
Armando Lüscher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow setting a custom Guzzle HTTP Client for requests.
parent
41cfa0b6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
6 deletions
+23
-6
CHANGELOG.md
CHANGELOG.md
+1
-0
Request.php
src/Request.php
+22
-6
No files found.
CHANGELOG.md
View file @
6e7024df
...
@@ -6,6 +6,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
...
@@ -6,6 +6,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
## [Unreleased]
## [Unreleased]
### Added
### Added
-
Documents can be sent by providing its contents via Psr7 stream (as opposed to passing a file path).
-
Documents can be sent by providing its contents via Psr7 stream (as opposed to passing a file path).
-
Allow setting a custom Guzzle HTTP Client for requests (#511).
### Changed
### Changed
### Deprecated
### Deprecated
### Removed
### Removed
...
...
src/Request.php
View file @
6e7024df
...
@@ -104,16 +104,32 @@ class Request
...
@@ -104,16 +104,32 @@ class Request
*
*
* @param \Longman\TelegramBot\Telegram $telegram
* @param \Longman\TelegramBot\Telegram $telegram
*
*
* @throws
\Longman\TelegramBot\Exception\
TelegramException
* @throws TelegramException
*/
*/
public
static
function
initialize
(
Telegram
$telegram
)
public
static
function
initialize
(
Telegram
$telegram
)
{
{
if
(
is_object
(
$telegram
))
{
if
(
!
(
$telegram
instanceof
Telegram
))
{
self
::
$telegram
=
$telegram
;
throw
new
TelegramException
(
'Invalid Telegram pointer!'
);
self
::
$client
=
new
Client
([
'base_uri'
=>
self
::
$api_base_uri
]);
}
}
else
{
throw
new
TelegramException
(
'Telegram pointer is empty!'
);
self
::
$telegram
=
$telegram
;
self
::
setClient
(
new
Client
([
'base_uri'
=>
self
::
$api_base_uri
]));
}
/**
* Set a custom Guzzle HTTP Client object
*
* @param Client $client
*
* @throws TelegramException
*/
public
static
function
setClient
(
Client
$client
)
{
if
(
!
(
$client
instanceof
Client
))
{
throw
new
TelegramException
(
'Invalid GuzzleHttp\Client pointer!'
);
}
}
self
::
$client
=
$client
;
}
}
/**
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment