diff --git a/composer.json b/composer.json index 9c4e1628c3188a5d419fd52bd6535c4202226e0e..cc5b25b9c558607dc7089ee47d8e3a7bee35f7d2 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "require": { "silex/silex": ">=2.0", "jards/eventsapiclient": "=3.0", - "jards/gcsjardsapiclient": "=2.0", + "jards/gcsjardsapiclient": "=2.1", "phpmailer/phpmailer": ">=6.0" }, "require-dev": { diff --git a/composer.lock b/composer.lock index bfd1678192368509c68c0e41ad7727caf566a76e..ab6186a62e946fdf546cb0c27fb1a63fc2f3f6ae 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "cdf21b69798ca5f38caf3b3006641ccb", + "content-hash": "59a3b1ffcc680df0da87660605b8e38c", "packages": [ { "name": "jards/eventsapiclient", @@ -57,11 +57,11 @@ }, { "name": "jards/gcsjardsapiclient", - "version": "v2.0", + "version": "v2.1", "source": { "type": "git", "url": "https://gitlab.version.fz-juelich.de/jards/GCSJARDSAPIClient.git", - "reference": "8cd17ed33e447f6af8adcda2e6bb3269e2587ee8" + "reference": "961a06c2218c7ad462479e72dd89bd200e84ed7c" }, "require": { "ext-curl": "*", @@ -102,7 +102,7 @@ "sdk", "swagger" ], - "time": "2018-01-22T12:20:35+00:00" + "time": "2018-02-14T12:04:30+00:00" }, { "name": "phpmailer/phpmailer", diff --git a/composer.phar b/composer.phar index 508f9cf274be7a7526630f9ef01c183e6b17612f..041775a1274ffc0a74952eec9ceedfc062644408 100755 Binary files a/composer.phar and b/composer.phar differ diff --git a/examples/gcsjards_upload_file.php b/examples/gcsjards_upload_file.php new file mode 100644 index 0000000000000000000000000000000000000000..f7187c47bf40a8a6d2e6f85f0bcac2f27cf3a180 --- /dev/null +++ b/examples/gcsjards_upload_file.php @@ -0,0 +1,54 @@ +<?php +/* + * Copyright (c) 2018, Forschungszentrum Juelich GmbH, Federal Republic of Germany. + * All rights reserved. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +require_once __DIR__ . '/../vendor/autoload.php'; + +$conf = parse_ini_file(__DIR__.'/../configs/gcsjardsapi.conf'); + +$certFile = $conf['CERTFILE']; +$certKey = $conf['CERTKEY']; +$certPassphrase = $conf['CERTPASSPHRASE']; +$baseURL = $conf['BASEURL']; + +date_default_timezone_set ( 'Europe/Amsterdam' ); +$apiClient = new \jards\gcsjardsapiclient\Swagger\Client\ApiClient (); +$apiClient->getConfig ()->setHost ( $baseURL ); + +if (! empty ( $certFile )) { + $apiClient->getConfig ()->setCertificate ( $certFile ); +} +if (! empty ( $certKey )) { + $apiClient->getConfig ()->setCertificateKey ( $certKey ); +} +if (! empty ( $certPassphrase )) { + $apiClient->getConfig ()->setCertificatePassphrase ( $certPassphrase ); +} + +$gcsjardsAPI = new \jards\gcsjardsapiclient\Swagger\Client\Api\FilesApi( $apiClient ); + +$appid = 19967; + +try { + $fileupload = new \SplFileObject('/path/to/example.pdf'); + $result = $gcsjardsAPI->filesAppidFilePost($appid, 'status', $fileupload); + + echo "Upload result: ".$result."\n"; +} catch ( \jards\gcsjardsapiclient\Swagger\Client\ApiException $e ) { + var_dump($e); + return false; +} + +?> \ No newline at end of file