mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 08:58:35 +00:00
chore: update request response filters for 1.7.x
This commit is contained in:
parent
c5d4173923
commit
c657e368cc
2 changed files with 27 additions and 6 deletions
|
|
@ -9,16 +9,17 @@ class V19 extends Filter
|
|||
// Convert 1.6 params to 1.7
|
||||
public function parse(array $content, string $model): array
|
||||
{
|
||||
/*
|
||||
Uncomment with first request filter; current is just a copy of V18
|
||||
switch ($model) {
|
||||
case 'functions.create':
|
||||
$content['something'] = $content['somethingElse'] ?? "";
|
||||
unset($content['something']);
|
||||
unset($content['templateRepository']);
|
||||
unset($content['templateOwner']);
|
||||
unset($content['templateRootDirectory']);
|
||||
unset($content['templateVersion']);
|
||||
break;
|
||||
case 'functions.listExecutions':
|
||||
unset($content['search']);
|
||||
break;
|
||||
}
|
||||
*/
|
||||
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ class V19 extends Filter
|
|||
$parsedResponse = match($model) {
|
||||
Response::MODEL_FUNCTION => $this->parseFunction($content),
|
||||
Response::MODEL_FUNCTION_LIST => $this->handleList($content, 'functions', fn ($item) => $this->parseFunction($item)),
|
||||
Response::MODEL_DEPLOYMENT => $this->parseDeployment($content),
|
||||
Response::MODEL_PROXY_RULE => $this->parseProxyRule($content),
|
||||
default => $parsedResponse,
|
||||
};
|
||||
|
||||
|
|
@ -27,4 +29,22 @@ class V19 extends Filter
|
|||
unset($content['deploymentId']);
|
||||
return $content;
|
||||
}
|
||||
|
||||
protected function parseDeployment(array $content)
|
||||
{
|
||||
$content['size'] = $content['sourceSize'] ?? '';
|
||||
$content['buildTime'] = $content['buildDuration'] ?? '';
|
||||
unset($content['sourceSize']);
|
||||
unset($content['buildDuration']);
|
||||
return $content;
|
||||
}
|
||||
|
||||
protected function parseProxyRule(array $content)
|
||||
{
|
||||
$content['resourceType'] = $content['deploymentResourceType'] ?? '';
|
||||
$content['resourceId'] = $content['deploymentResourceId'] ?? '';
|
||||
unset($content['deploymentResourceType']);
|
||||
unset($content['deploymentResourceId']);
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue