mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 09:28:40 +00:00
Use parameter class in method class
This commit is contained in:
parent
6615c1a382
commit
254c12b084
1 changed files with 10 additions and 9 deletions
|
|
@ -20,16 +20,14 @@ class Method
|
||||||
* @param string $description
|
* @param string $description
|
||||||
* @param array<AuthType> $auth
|
* @param array<AuthType> $auth
|
||||||
* @param array<SDKResponse> $responses
|
* @param array<SDKResponse> $responses
|
||||||
* @param ContentType $responseType
|
* @param ContentType $contentType
|
||||||
* @param MethodType|null $methodType
|
* @param MethodType|null $type
|
||||||
* @param bool $deprecated
|
* @param bool $deprecated
|
||||||
* @param array|bool $hide
|
* @param array|bool $hide
|
||||||
* @param bool $packaging
|
* @param bool $packaging
|
||||||
* @param string $requestType
|
* @param ContentType $requestType
|
||||||
* @param array $parameters
|
* @param array<Parameter> $parameters
|
||||||
* @param array $additionalParameters
|
* @param array $additionalParameters
|
||||||
*
|
|
||||||
* @throws \Exception
|
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected string $namespace,
|
protected string $namespace,
|
||||||
|
|
@ -42,16 +40,16 @@ class Method
|
||||||
protected bool $deprecated = false,
|
protected bool $deprecated = false,
|
||||||
protected array|bool $hide = false,
|
protected array|bool $hide = false,
|
||||||
protected bool $packaging = false,
|
protected bool $packaging = false,
|
||||||
protected string $requestType = 'application/json',
|
protected ContentType $requestType = ContentType::JSON,
|
||||||
protected array $parameters = [],
|
protected array $parameters = [],
|
||||||
protected array $additionalParameters = []
|
protected array $additionalParameters = []
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
$this->validateMethod($name, $namespace);
|
$this->validateMethod($name, $namespace);
|
||||||
$this->validateAuthTypes($auth);
|
$this->validateAuthTypes($auth);
|
||||||
$this->validateDesc($description);
|
$this->validateDesc($description);
|
||||||
|
|
||||||
foreach ($responses as $response) {
|
foreach ($responses as $response) {
|
||||||
/** @var SDKResponse $response */
|
|
||||||
$this->validateResponseModel($response->getModel());
|
$this->validateResponseModel($response->getModel());
|
||||||
$this->validateNoContent($response);
|
$this->validateNoContent($response);
|
||||||
}
|
}
|
||||||
|
|
@ -189,6 +187,9 @@ class Method
|
||||||
return $this->requestType;
|
return $this->requestType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<Parameter>
|
||||||
|
*/
|
||||||
public function getParameters(): array
|
public function getParameters(): array
|
||||||
{
|
{
|
||||||
return $this->parameters;
|
return $this->parameters;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue