mirror of
https://github.com/SociallyDev/Spaces-API.git
synced 2025-08-14 02:27:23 -07:00
v2: Updates
* Simplifies & beautifies everything * Introduces a new Class system. * Errors are defaulted to AWS's handler. * New function names & more efficient handling. * Should fix a majority of the errors. Please read the README for more!
This commit is contained in:
parent
ad0726e41e
commit
e6d7753dc8
1095 changed files with 45088 additions and 2911 deletions
|
@ -123,8 +123,11 @@ abstract class RestSerializer
|
|||
|
||||
private function applyHeader($name, Shape $member, $value, array &$opts)
|
||||
{
|
||||
if ($member->getType() == 'timestamp') {
|
||||
$value = TimestampShape::format($value, 'rfc822');
|
||||
if ($member->getType() === 'timestamp') {
|
||||
$timestampFormat = !empty($member['timestampFormat'])
|
||||
? $member['timestampFormat']
|
||||
: 'rfc822';
|
||||
$value = TimestampShape::format($value, $timestampFormat);
|
||||
}
|
||||
if ($member['jsonvalue']) {
|
||||
$value = json_encode($value);
|
||||
|
@ -157,8 +160,14 @@ abstract class RestSerializer
|
|||
? $opts['query'] + $value
|
||||
: $value;
|
||||
} elseif ($value !== null) {
|
||||
if ($member->getType() === 'boolean') {
|
||||
$type = $member->getType();
|
||||
if ($type === 'boolean') {
|
||||
$value = $value ? 'true' : 'false';
|
||||
} elseif ($type === 'timestamp') {
|
||||
$timestampFormat = !empty($member['timestampFormat'])
|
||||
? $member['timestampFormat']
|
||||
: 'iso8601';
|
||||
$value = TimestampShape::format($value, $timestampFormat);
|
||||
}
|
||||
|
||||
$opts['query'][$member['locationName'] ?: $name] = $value;
|
||||
|
@ -186,11 +195,13 @@ abstract class RestSerializer
|
|||
$k = $isGreedy ? substr($matches[1], 0, -1) : $matches[1];
|
||||
if (!isset($varspecs[$k])) {
|
||||
return '';
|
||||
} elseif ($isGreedy) {
|
||||
return str_replace('%2F', '/', rawurlencode($varspecs[$k]));
|
||||
} else {
|
||||
return rawurlencode($varspecs[$k]);
|
||||
}
|
||||
|
||||
if ($isGreedy) {
|
||||
return str_replace('%2F', '/', rawurlencode($varspecs[$k]));
|
||||
}
|
||||
|
||||
return rawurlencode($varspecs[$k]);
|
||||
},
|
||||
$operation['http']['requestUri']
|
||||
);
|
||||
|
@ -201,6 +212,12 @@ abstract class RestSerializer
|
|||
$relative .= strpos($relative, '?') ? "&{$append}" : "?$append";
|
||||
}
|
||||
|
||||
// If endpoint has path, remove leading '/' to preserve URI resolution.
|
||||
$path = $this->endpoint->getPath();
|
||||
if ($path && $relative[0] === '/') {
|
||||
$relative = substr($relative, 1);
|
||||
}
|
||||
|
||||
// Expand path place holders using Amazon's slightly different URI
|
||||
// template syntax.
|
||||
return UriResolver::resolve($this->endpoint, new Uri($relative));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue