Constructor.
Parameters
$methodWordPressAiClientProvidersHttpEnumsHttpMethodEnumrequired- The HTTP method.
$uristringrequired- The request URI.
- mixed>|null $data The request data.
$optionsWordPressAiClientProvidersHttpDTORequestOptions|nulloptional- The request transport options.
Default:
null
Source
public function __construct(HttpMethodEnum $method, string $uri, array $headers = [], $data = null, ?\WordPress\AiClient\Providers\Http\DTO\RequestOptions $options = null)
{
if (empty($uri)) {
throw new InvalidArgumentException('URI cannot be empty.');
}
$this->method = $method;
$this->uri = $uri;
$this->headers = new HeadersCollection($headers);
// Separate data and body based on type
if (is_string($data)) {
$this->body = $data;
} elseif (is_array($data)) {
$this->data = $data;
}
$this->options = $options;
}
Changelog
| Version | Description |
|---|---|
| 0.1.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.