WordPress\AiClient\Providers\DTO

ProviderMetadata::__constructpublicWP 0.1.0

Constructor.

Method of the class: ProviderMetadata{}

No Hooks.

Returns

null. Nothing (null).

Usage

$ProviderMetadata = new ProviderMetadata();
$ProviderMetadata->__construct( $id, $name, $type, ?string $credentialsUrl, ?RequestAuthenticationMethod $authenticationMethod, ?string $description, ?string $logoPath );
$id(string) (required)
The provider's unique identifier.
$name(string) (required)
The provider's display name.
$type(ProviderTypeEnum) (required)
The provider type.
?string $credentialsUrl
.
Default: null
?RequestAuthenticationMethod $authenticationMethod
.
Default: null
?string $description
.
Default: null
?string $logoPath
.
Default: null

Changelog

Since 0.1.0 Introduced.
Since 1.2.0 Added optional $description parameter.
Since 1.3.0 Added optional $logoPath parameter.

ProviderMetadata::__construct() code WP 7.0

public function __construct(string $id, string $name, ProviderTypeEnum $type, ?string $credentialsUrl = null, ?RequestAuthenticationMethod $authenticationMethod = null, ?string $description = null, ?string $logoPath = null)
{
    if (!preg_match('/^[a-z0-9\-_]+$/', $id)) {
        throw new InvalidArgumentException(sprintf(
            // phpcs:ignore Generic.Files.LineLength.TooLong
            'Invalid provider ID "%s". Only lowercase alphanumeric characters, hyphens, and underscores are allowed.',
            $id
        ));
    }
    $this->id = $id;
    $this->name = $name;
    $this->description = $description;
    $this->type = $type;
    $this->credentialsUrl = $credentialsUrl;
    $this->authenticationMethod = $authenticationMethod;
    $this->logoPath = $logoPath;
}