mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 09:28:40 +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
|
// Convert 1.6 params to 1.7
|
||||||
public function parse(array $content, string $model): array
|
public function parse(array $content, string $model): array
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
Uncomment with first request filter; current is just a copy of V18
|
|
||||||
switch ($model) {
|
switch ($model) {
|
||||||
case 'functions.create':
|
case 'functions.create':
|
||||||
$content['something'] = $content['somethingElse'] ?? "";
|
unset($content['templateRepository']);
|
||||||
unset($content['something']);
|
unset($content['templateOwner']);
|
||||||
|
unset($content['templateRootDirectory']);
|
||||||
|
unset($content['templateVersion']);
|
||||||
|
break;
|
||||||
|
case 'functions.listExecutions':
|
||||||
|
unset($content['search']);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@ class V19 extends Filter
|
||||||
$parsedResponse = match($model) {
|
$parsedResponse = match($model) {
|
||||||
Response::MODEL_FUNCTION => $this->parseFunction($content),
|
Response::MODEL_FUNCTION => $this->parseFunction($content),
|
||||||
Response::MODEL_FUNCTION_LIST => $this->handleList($content, 'functions', fn ($item) => $this->parseFunction($item)),
|
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,
|
default => $parsedResponse,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -27,4 +29,22 @@ class V19 extends Filter
|
||||||
unset($content['deploymentId']);
|
unset($content['deploymentId']);
|
||||||
return $content;
|
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