Skip to content

Commit

Permalink
Organize Nuxeo\Client\Api\Objects + code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
pgmillon committed Dec 30, 2016
1 parent 1234523 commit f4b105e
Show file tree
Hide file tree
Showing 54 changed files with 112 additions and 101 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile
Expand Up @@ -34,4 +34,4 @@ node('SLAVE') {
step([$class: 'ClaimPublisher'])
throw e
}
}
}
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -107,8 +107,8 @@ $result = $operation->execute(Documents::className);
```

```php
use Nuxeo\Client\Api\Objects\Blob;
use Nuxeo\Client\Api\Objects\Blobs;
use Nuxeo\Client\Api\Objects\Blob\Blob;
use Nuxeo\Client\Api\Objects\Blob\Blobs;

// To upload|download blob(s)

Expand Down
2 changes: 1 addition & 1 deletion docker/nginx/nginx.conf
Expand Up @@ -19,4 +19,4 @@ http {
sendfile on;

include /etc/nginx/conf.d/*.conf;
}
}
2 changes: 1 addition & 1 deletion docker/nuxeo/nuxeo.defaults
@@ -1 +1 @@
custom.target=.
custom.target=.
2 changes: 1 addition & 1 deletion docker/php-fpm/Dockerfile
Expand Up @@ -15,4 +15,4 @@ RUN useradd -M -d /var/www/html -u 1000 -s /sbin/nologin php
WORKDIR /var/www/html

EXPOSE 9000
CMD ["php-fpm"]
CMD ["php-fpm"]
2 changes: 1 addition & 1 deletion docker/qa/Dockerfile
Expand Up @@ -12,4 +12,4 @@ RUN php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filenam

ENV PATH=$PATH:vendor/bin

RUN apt-get update && apt-get install -y nodejs-legacy git unzip
RUN apt-get update && apt-get install -y nodejs-legacy git unzip
2 changes: 1 addition & 1 deletion samples/B1.php
Expand Up @@ -95,4 +95,4 @@
<?php endif ?>
</div>
</body>
</html>
</html>
4 changes: 2 additions & 2 deletions samples/B4.php
Expand Up @@ -62,9 +62,9 @@
try {
if(null !== $document) {
$client->automation('Blob.Attach')
->input(\Nuxeo\Client\Api\Objects\Blob::fromFile($blob->getPathname(), $blob->getMimeType()))
->input(\Nuxeo\Client\Api\Objects\Blob\Blob::fromFile($blob->getPathname(), $blob->getMimeType()))
->param('document', $document->getPath())
->execute(\Nuxeo\Client\Api\Objects\Blob::className);
->execute(\Nuxeo\Client\Api\Objects\Blob\Blob::className);
}
} catch(\Nuxeo\Client\Internals\Spi\NuxeoClientException $ex) {
throw new RuntimeException('Could not attach blob to document: ' . $ex->getMessage());
Expand Down
6 changes: 3 additions & 3 deletions samples/B5.php
Expand Up @@ -26,11 +26,11 @@
$path = $_POST['path'];

try {
/** @var \Nuxeo\Client\Api\Objects\Blob $blob */
/** @var \Nuxeo\Client\Api\Objects\Blob\Blob $blob */
$blob = $client
->automation('Blob.Get')
->input('doc:' . $path)
->execute(\Nuxeo\Client\Api\Objects\Blob::className);
->execute(\Nuxeo\Client\Api\Objects\Blob\Blob::className);

$response = new \Symfony\Component\HttpFoundation\BinaryFileResponse($blob->getFile());
$response->setContentDisposition(
Expand Down Expand Up @@ -75,4 +75,4 @@
</form>
</div>
</body>
</html>
</html>
2 changes: 1 addition & 1 deletion samples/samples.css
Expand Up @@ -23,4 +23,4 @@ body {

form {
padding-bottom: 10px;
}
}
2 changes: 1 addition & 1 deletion src/Nuxeo/Client/Api/Constants.php
Expand Up @@ -40,5 +40,5 @@ class Constants {
const ENTITY_TYPE_DOCUMENTS = 'documents';

const ENTITY_TYPE_OPERATION = 'operation';

}
Expand Up @@ -57,4 +57,4 @@ public function write($object, VisitorInterface $visitor, SerializationContext $
return $context->accept($object, $this->getType());
}

}
}
2 changes: 1 addition & 1 deletion src/Nuxeo/Client/Api/Marshaller/BlobMarshaller.php
Expand Up @@ -47,4 +47,4 @@ public function write($object, VisitorInterface $visitor, SerializationContext $
return null;
}

}
}
2 changes: 1 addition & 1 deletion src/Nuxeo/Client/Api/Marshaller/BlobsMarshaller.php
Expand Up @@ -23,4 +23,4 @@

class BlobsMarshaller extends BlobMarshaller {

}
}
4 changes: 2 additions & 2 deletions src/Nuxeo/Client/Api/Marshaller/CounterListMarshaller.php
Expand Up @@ -19,8 +19,8 @@
namespace Nuxeo\Client\Api\Marshaller;


use Nuxeo\Client\Api\Objects\Counter;
use Nuxeo\Client\Api\Objects\CounterList;
use Nuxeo\Client\Api\Objects\Operation\Counter;
use Nuxeo\Client\Api\Objects\Operation\CounterList;

class CounterListMarshaller extends AbstractJsonObjectMarshaller {

Expand Down
Expand Up @@ -19,7 +19,7 @@
namespace Nuxeo\Client\Api\Marshaller;


use Nuxeo\Client\Api\Objects\CounterTimestampedValue;
use Nuxeo\Client\Api\Objects\Operation\CounterTimestampedValue;

class CounterTimestampedValueMarshaller extends AbstractJsonObjectMarshaller {

Expand All @@ -31,4 +31,4 @@ protected function getClassName() {
return CounterTimestampedValue::className;
}

}
}
Expand Up @@ -21,8 +21,8 @@
namespace Nuxeo\Client\Api\Marshaller;


use Nuxeo\Client\Api\Objects\DirectoryEntries;
use Nuxeo\Client\Api\Objects\DirectoryEntry;
use Nuxeo\Client\Api\Objects\Directory\DirectoryEntry;
use Nuxeo\Client\Api\Objects\Operation\DirectoryEntries;

class DirectoryEntriesMarshaller extends AbstractJsonObjectMarshaller {

Expand Down
4 changes: 2 additions & 2 deletions src/Nuxeo/Client/Api/Marshaller/DocRefMarshaller.php
Expand Up @@ -24,7 +24,7 @@
use JMS\Serializer\DeserializationContext;
use JMS\Serializer\SerializationContext;
use JMS\Serializer\VisitorInterface;
use Nuxeo\Client\Api\Objects\DocRef;
use Nuxeo\Client\Api\Objects\Operation\DocRef;

class DocRefMarshaller implements NuxeoMarshaller {

Expand All @@ -48,4 +48,4 @@ public function read($in, VisitorInterface $visitor, DeserializationContext $con
return new DocRef($in);
}

}
}
2 changes: 1 addition & 1 deletion src/Nuxeo/Client/Api/Marshaller/NuxeoConverter.php
Expand Up @@ -126,4 +126,4 @@ function(VisitorInterface $visitor, $object, array $type, DeserializationContext
return $this->serializer;
}

}
}
2 changes: 1 addition & 1 deletion src/Nuxeo/Client/Api/Marshaller/NuxeoMarshaller.php
Expand Up @@ -33,4 +33,4 @@ public function write($object, VisitorInterface $visitor, SerializationContext $

const className = __CLASS__;

}
}
13 changes: 5 additions & 8 deletions src/Nuxeo/Client/Api/NuxeoClient.php
Expand Up @@ -35,11 +35,8 @@
use Nuxeo\Client\Api\Marshaller\CounterTimestampedValueMarshaller;
use Nuxeo\Client\Api\Marshaller\DirectoryEntriesMarshaller;
use Nuxeo\Client\Api\Marshaller\NuxeoConverter;
use Nuxeo\Client\Api\Objects\Blob;
use Nuxeo\Client\Api\Objects\Blobs;
use Nuxeo\Client\Api\Objects\CounterList;
use Nuxeo\Client\Api\Objects\CounterTimestampedValue;
use Nuxeo\Client\Api\Objects\DirectoryEntries;
use Nuxeo\Client\Api\Objects\Blob\Blob;
use Nuxeo\Client\Api\Objects\Blob\Blobs;
use Nuxeo\Client\Api\Objects\Operation;
use Nuxeo\Client\Internals\Spi\Auth\AuthenticationInterceptor;
use Nuxeo\Client\Internals\Spi\Http\EntityEnclosingRequest;
Expand Down Expand Up @@ -218,9 +215,9 @@ public function getConverter() {
protected function setupDefaultMarshallers() {
$this->getConverter()->registerMarshaller(Blob::className, new BlobMarshaller());
$this->getConverter()->registerMarshaller(Blobs::className, new BlobsMarshaller());
$this->getConverter()->registerMarshaller(CounterList::className, new CounterListMarshaller());
$this->getConverter()->registerMarshaller(CounterTimestampedValue::className, new CounterTimestampedValueMarshaller());
$this->getConverter()->registerMarshaller(DirectoryEntries::className, new DirectoryEntriesMarshaller());
$this->getConverter()->registerMarshaller(Operation\CounterList::className, new CounterListMarshaller());
$this->getConverter()->registerMarshaller(Operation\CounterTimestampedValue::className, new CounterTimestampedValueMarshaller());
$this->getConverter()->registerMarshaller(Operation\DirectoryEntries::className, new DirectoryEntriesMarshaller());
return $this;
}

Expand Down
Expand Up @@ -14,19 +14,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* Pierre-Gildas MILLON <pgmillon@nuxeo.com>
*/

namespace Nuxeo\Client\Api\Objects;

namespace Nuxeo\Client\Api\Objects\Blob;

use Guzzle\Http\Message\Response;
use Nuxeo\Client\Api\Objects\NuxeoEntity;
use Nuxeo\Client\Internals\Spi\Http\Header\ContentDisposition;
use Nuxeo\Client\Internals\Spi\NoSuchFileException;
use Nuxeo\Client\Internals\Spi\NuxeoClientException;
use Nuxeo\Client\Internals\Util\IOUtils;


class Blob extends NuxeoEntity {

const className = __CLASS__;
Expand Down Expand Up @@ -109,4 +108,4 @@ public function getFile() {
return $this->file;
}

}
}
Expand Up @@ -14,13 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* Pierre-Gildas MILLON <pgmillon@nuxeo.com>
*/

namespace Nuxeo\Client\Api\Objects;
namespace Nuxeo\Client\Api\Objects\Blob;

use JMS\Serializer\Annotation as Serializer;
use Nuxeo\Client\Api\Objects\NuxeoEntity;


class Blobs extends NuxeoEntity implements \Countable {
Expand Down Expand Up @@ -60,4 +59,4 @@ public function add($blob) {
public function count() {
return count($this->blobs);
}
}
}
Expand Up @@ -14,11 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* Pierre-Gildas MILLON <pgmillon@nuxeo.com>
*/

namespace Nuxeo\Client\Api\Objects;
namespace Nuxeo\Client\Api\Objects\Directory;


use JMS\Serializer\Annotation as Serializer;
Expand Down Expand Up @@ -113,4 +111,4 @@ public function getLabel() {
return $this->label;
}

}
}
2 changes: 1 addition & 1 deletion src/Nuxeo/Client/Api/Objects/Document.php
Expand Up @@ -353,4 +353,4 @@ public function setProperties($properties) {
$this->properties = $properties;
}

}
}
2 changes: 1 addition & 1 deletion src/Nuxeo/Client/Api/Objects/Documents.php
Expand Up @@ -265,4 +265,4 @@ public function getPageCount() {
return $this->pageCount;
}

}
}
3 changes: 2 additions & 1 deletion src/Nuxeo/Client/Api/Objects/NuxeoEntity.php
Expand Up @@ -25,6 +25,7 @@
use JMS\Serializer\Annotation as Serializer;
use Nuxeo\Client\Api\Constants;
use Nuxeo\Client\Api\NuxeoClient;
use Nuxeo\Client\Api\Objects\Blob\Blob;
use Nuxeo\Client\Internals\Spi\ClassCastException;

abstract class NuxeoEntity {
Expand Down Expand Up @@ -81,4 +82,4 @@ protected function computeResponse($response, $type) {
return $this->nuxeoClient->getConverter()->readJSON($body, $type);
}

}
}
5 changes: 4 additions & 1 deletion src/Nuxeo/Client/Api/Objects/Operation.php
Expand Up @@ -25,6 +25,9 @@
use JMS\Serializer\Annotation as Serializer;
use Nuxeo\Client\Api\Constants;
use Nuxeo\Client\Api\NuxeoClient;
use Nuxeo\Client\Api\Objects\Blob\Blob;
use Nuxeo\Client\Api\Objects\Blob\Blobs;
use Nuxeo\Client\Api\Objects\Operation\OperationBody;
use Nuxeo\Client\Internals\Spi\ClassCastException;
use Nuxeo\Client\Internals\Spi\NoSuchOperationException;
use Nuxeo\Client\Internals\Spi\NuxeoClientException;
Expand Down Expand Up @@ -160,4 +163,4 @@ protected function _doExecute($operationId) {
return $response;
}

}
}
Expand Up @@ -16,7 +16,7 @@
*
*/

namespace Nuxeo\Client\Api\Objects;
namespace Nuxeo\Client\Api\Objects\Operation;


use JMS\Serializer\Annotation as Serializer;
Expand All @@ -27,19 +27,19 @@ class Counter {

/**
* @var CounterTimestampedValue[]
* @Serializer\Type("array<Nuxeo\Client\Api\Objects\CounterTimestampedValue>")
* @Serializer\Type("array<Nuxeo\Client\Api\Objects\Operation\CounterTimestampedValue>")
*/
protected $values;

/**
* @var CounterTimestampedValue[]
* @Serializer\Type("array<Nuxeo\Client\Api\Objects\CounterTimestampedValue>")
* @Serializer\Type("array<Nuxeo\Client\Api\Objects\Operation\CounterTimestampedValue>")
*/
protected $deltas;

/**
* @var CounterTimestampedValue[]
* @Serializer\Type("array<Nuxeo\Client\Api\Objects\CounterTimestampedValue>")
* @Serializer\Type("array<Nuxeo\Client\Api\Objects\Operation\CounterTimestampedValue>")
*/
protected $speed;

Expand Down
Expand Up @@ -16,7 +16,7 @@
*
*/

namespace Nuxeo\Client\Api\Objects;
namespace Nuxeo\Client\Api\Objects\Operation;


use JMS\Serializer\Annotation as Serializer;
Expand All @@ -25,4 +25,4 @@ class CounterList extends \ArrayObject {

const className = __CLASS__;

}
}
Expand Up @@ -16,7 +16,7 @@
*
*/

namespace Nuxeo\Client\Api\Objects;
namespace Nuxeo\Client\Api\Objects\Operation;


use JMS\Serializer\Annotation as Serializer;
Expand Down Expand Up @@ -57,4 +57,4 @@ public function getValue() {
return $this->value;
}

}
}

0 comments on commit f4b105e

Please sign in to comment.