Removed rudimentary code
This commit is contained in:
parent
b630b73f1d
commit
da3405661a
@ -67,7 +67,6 @@ class Client
|
||||
* @param string $method
|
||||
* @param object|null $request Request parameters
|
||||
* @param string $responseType
|
||||
* @param string $serializeTo
|
||||
* @param bool $arrayOfObjects
|
||||
*
|
||||
* @return object|null
|
||||
@ -78,14 +77,12 @@ class Client
|
||||
$method,
|
||||
$request,
|
||||
$responseType,
|
||||
$serializeTo = Serializer::S_JSON,
|
||||
$arrayOfObjects = false
|
||||
) {
|
||||
$response = $this->client->makeRequest(
|
||||
$path,
|
||||
$method,
|
||||
$request,
|
||||
$serializeTo
|
||||
$request
|
||||
);
|
||||
|
||||
$data = json_decode((string) $response->getBody(), true);
|
||||
@ -167,7 +164,6 @@ class Client
|
||||
HttpClient::METHOD_GET,
|
||||
$request,
|
||||
static::getEntityClass('Bot'),
|
||||
Serializer::S_ARRAY,
|
||||
true
|
||||
);
|
||||
}
|
||||
@ -205,7 +201,6 @@ class Client
|
||||
HttpClient::METHOD_GET,
|
||||
$request,
|
||||
static::getEntityClass('Channel', 'Channel'),
|
||||
Serializer::S_ARRAY,
|
||||
true
|
||||
);
|
||||
}
|
||||
@ -225,7 +220,6 @@ class Client
|
||||
HttpClient::METHOD_GET,
|
||||
$request,
|
||||
static::getEntityClass('Chat', 'Chat'),
|
||||
Serializer::S_ARRAY,
|
||||
true
|
||||
);
|
||||
}
|
||||
@ -245,7 +239,6 @@ class Client
|
||||
HttpClient::METHOD_GET,
|
||||
$request,
|
||||
static::getEntityClass('Command'),
|
||||
Serializer::S_ARRAY,
|
||||
true
|
||||
);
|
||||
}
|
||||
@ -264,8 +257,7 @@ class Client
|
||||
sprintf("/my/commands/%s", $request->getName()),
|
||||
HttpClient::METHOD_PUT,
|
||||
$request,
|
||||
static::getResponseClass(self::ERROR_ONLY_RESPONSE),
|
||||
Serializer::S_JSON
|
||||
static::getResponseClass(self::ERROR_ONLY_RESPONSE)
|
||||
);
|
||||
}
|
||||
|
||||
@ -283,8 +275,7 @@ class Client
|
||||
sprintf("/my/commands/%s", $request),
|
||||
HttpClient::METHOD_DELETE,
|
||||
null,
|
||||
static::getResponseClass(self::ERROR_ONLY_RESPONSE),
|
||||
Serializer::S_JSON
|
||||
static::getResponseClass(self::ERROR_ONLY_RESPONSE)
|
||||
);
|
||||
}
|
||||
|
||||
@ -303,7 +294,6 @@ class Client
|
||||
HttpClient::METHOD_GET,
|
||||
$request,
|
||||
static::getEntityClass('Customer'),
|
||||
Serializer::S_ARRAY,
|
||||
true
|
||||
);
|
||||
}
|
||||
@ -323,7 +313,6 @@ class Client
|
||||
HttpClient::METHOD_GET,
|
||||
$request,
|
||||
static::getEntityClass('Dialog'),
|
||||
Serializer::S_ARRAY,
|
||||
true
|
||||
);
|
||||
}
|
||||
@ -342,8 +331,7 @@ class Client
|
||||
sprintf("/dialogs/%d/assign", $request->getDialogId()),
|
||||
HttpClient::METHOD_PATCH,
|
||||
$request,
|
||||
static::getResponseClass('AssignResponse'),
|
||||
Serializer::S_JSON
|
||||
static::getResponseClass('AssignResponse')
|
||||
);
|
||||
}
|
||||
|
||||
@ -380,7 +368,6 @@ class Client
|
||||
HttpClient::METHOD_GET,
|
||||
$request,
|
||||
static::getEntityClass('Chat', 'ChatMember'),
|
||||
Serializer::S_ARRAY,
|
||||
true
|
||||
);
|
||||
}
|
||||
@ -400,7 +387,6 @@ class Client
|
||||
HttpClient::METHOD_GET,
|
||||
$request,
|
||||
self::getEntityClass('Message', 'Message'),
|
||||
Serializer::S_ARRAY,
|
||||
true
|
||||
);
|
||||
}
|
||||
@ -474,7 +460,6 @@ class Client
|
||||
HttpClient::METHOD_GET,
|
||||
$request,
|
||||
self::getEntityClass('User'),
|
||||
Serializer::S_ARRAY,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
@ -107,12 +107,11 @@ class HttpClient
|
||||
* @param string $path Request URL
|
||||
* @param string $method Request method (default: 'GET')
|
||||
* @param mixed $request Request model (default: null)
|
||||
* @param string $serializeTo Serializer::S_JSON or Serializer::S_ARRAY
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function makeRequest($path, $method, $request = null, $serializeTo = Serializer::S_JSON)
|
||||
public function makeRequest($path, $method, $request = null)
|
||||
{
|
||||
$getParameters = '';
|
||||
|
||||
@ -126,7 +125,7 @@ class HttpClient
|
||||
$getParameters = Url::buildGetParameters(Serializer::serialize($request, Serializer::S_ARRAY));
|
||||
}
|
||||
|
||||
$parameters = is_null($request) ? null : Serializer::serialize($request, $serializeTo);
|
||||
$requestBody = is_null($request) ? null : Serializer::serialize($request, Serializer::S_JSON);
|
||||
$request = new Request(
|
||||
$method,
|
||||
\sprintf("%s%s%s", $this->basePath, $path, $getParameters),
|
||||
@ -137,7 +136,7 @@ class HttpClient
|
||||
);
|
||||
|
||||
if (in_array($method, [self::METHOD_POST, self::METHOD_PUT, self::METHOD_PATCH, self::METHOD_DELETE])) {
|
||||
$request = $request->withBody(stream_for($parameters));
|
||||
$request = $request->withBody(stream_for($requestBody));
|
||||
}
|
||||
|
||||
$responseObject = null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user