diff --git a/Makefile b/Makefile index 2fabf9f0..339f0db1 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ build: docker buildx build --build-arg=PHP_VERSION=$(PHP_VERSION) -t php-composer:$(PHP_VERSION) . lint: build - docker run --rm -v ./:/code -v/code/vendor php-composer:$(PHP_VERSION) bash -c 'vendor/bin/phpcs --standard=phpcs.xml.dist --warning-severity=0 -p src/ scripts/ test/' + docker run --rm -v ./:/code -v/code/vendor php-composer:$(PHP_VERSION) bash -c 'vendor/bin/phpcs --standard=phpcs.xml.dist --warning-severity=0 -p src/ scripts/ test/ spec/' test: build lint docker run --rm -v ./:/code -v/code/vendor php-composer:$(PHP_VERSION) bash -c './project_tests.sh' diff --git a/composer.json b/composer.json index f4095000..15eba2ac 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,8 @@ }, "autoload-dev": { "psr-4": { - "test\\eLife\\ApiSdk\\": "./test" + "test\\eLife\\ApiSdk\\": "./test", + "spec\\eLife\\ApiSdk\\": "./spec" } }, "require": { @@ -28,6 +29,8 @@ "justinrainbow/json-schema": "^3.0 || ^4.0 || ^5.0", "mindplay/composer-locator": "^2.1.1", "mtdowling/jmespath.php": "^2.0", + "phpspec/phpspec": "^5.1 || ^6.3 || ^7.5", + "phpspec/prophecy": "^1.10", "phpunit/phpunit": "^5.2", "psr/http-message": "^1.0", "squizlabs/php_codesniffer": "^3.5" diff --git a/phpspec.yml.dist b/phpspec.yml.dist new file mode 100644 index 00000000..4675fab3 --- /dev/null +++ b/phpspec.yml.dist @@ -0,0 +1,4 @@ +suites: + api-client: + namespace: eLife\ApiSdk + psr4_prefix: eLife\ApiSdk diff --git a/project_tests.sh b/project_tests.sh index 6a639985..151619b9 100755 --- a/project_tests.sh +++ b/project_tests.sh @@ -2,5 +2,6 @@ #!/bin/bash set -e -vendor/bin/phpcs --standard=phpcs.xml.dist --warning-severity=0 -p src/ scripts/ test/ +vendor/bin/phpcs --standard=phpcs.xml.dist --warning-severity=0 -p src/ scripts/ test/ spec/ vendor/bin/phpunit --log-junit="build/${dependencies}-phpunit.xml" +vendor/bin/phpspec run diff --git a/spec/ApiClient/AnnotationsClientSpec.php b/spec/ApiClient/AnnotationsClientSpec.php new file mode 100644 index 00000000..0073ab3b --- /dev/null +++ b/spec/ApiClient/AnnotationsClientSpec.php @@ -0,0 +1,36 @@ +httpClient = $httpClient; + + $this->beConstructedWith($httpClient, ['X-Foo' => 'bar']); + } + + public function it_lists_annotations() + { + $request = new Request('GET', 'annotations?by=user&page=1&per-page=20&order=desc&use-date=updated&access=restricted', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.annotation-list+json; version=1', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.annotation-list+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->listAnnotations(['Accept' => 'application/vnd.elife.annotation-list+json; version=1'], 'user', 1, 20, true, 'updated', 'restricted') + ->shouldBeLike($response); + } +} diff --git a/spec/ApiClient/AnnualReportsClientSpec.php b/spec/ApiClient/AnnualReportsClientSpec.php new file mode 100644 index 00000000..0f9287a0 --- /dev/null +++ b/spec/ApiClient/AnnualReportsClientSpec.php @@ -0,0 +1,49 @@ +httpClient = $httpClient; + + $this->beConstructedWith($httpClient, ['X-Foo' => 'bar']); + } + + public function it_gets_an_annual_report() + { + $request = new Request('GET', 'annual-reports/2012', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.annual-report+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.annual-report+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->getReport(['Accept' => 'application/vnd.elife.annual-report+json; version=2'], 2012) + ->shouldBeLike($response); + } + + public function it_lists_annual_reports() + { + $request = new Request('GET', 'annual-reports?page=1&per-page=20&order=desc', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.annual-report-list+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.annual-report-list+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->listReports(['Accept' => 'application/vnd.elife.annual-report-list+json; version=2'], 1, 20, true) + ->shouldBeLike($response); + } +} diff --git a/spec/ApiClient/ArticlesClientSpec.php b/spec/ApiClient/ArticlesClientSpec.php new file mode 100644 index 00000000..a7898962 --- /dev/null +++ b/spec/ApiClient/ArticlesClientSpec.php @@ -0,0 +1,93 @@ +httpClient = $httpClient; + + $this->beConstructedWith($httpClient, ['X-Foo' => 'bar']); + } + + public function it_gets_a_latest_version_for_an_article() + { + $request = new Request('GET', 'articles/3', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.article-poa+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.article-poa+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->getArticleLatestVersion(['Accept' => 'application/vnd.elife.article-poa+json; version=2'], '3') + ->shouldBeLike($response) + ; + } + + public function it_gets_a_history_for_an_article() + { + $request = new Request('GET', 'articles/3/versions', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.article-history+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.article-history+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->getArticleHistory(['Accept' => 'application/vnd.elife.article-history+json; version=2'], '3') + ->shouldBeLike($response) + ; + } + + public function it_gets_related_articles_for_an_article() + { + $request = new Request('GET', 'articles/3/related', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.article-related+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.article-related+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->getRelatedArticles(['Accept' => 'application/vnd.elife.article-related+json; version=2'], '3') + ->shouldBeLike($response); + } + + public function it_gets_a_version_for_an_article() + { + $request = new Request('GET', 'articles/3/versions/2', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.article-poa+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.article-poa+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->getArticleVersion(['Accept' => 'application/vnd.elife.article-poa+json; version=2'], '3', 2) + ->shouldBeLike($response) + ; + } + + public function it_lists_articles() + { + $request = new Request('GET', 'articles?page=1&per-page=20&order=desc&subject[]=cell-biology', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.articles-list+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.articles-list+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->listArticles(['Accept' => 'application/vnd.elife.articles-list+json; version=2'], + 1, 20, true, ['cell-biology']) + ->shouldBeLike($response) + ; + } +} diff --git a/spec/ApiClient/BioprotocolClientSpec.php b/spec/ApiClient/BioprotocolClientSpec.php new file mode 100644 index 00000000..9bb0b390 --- /dev/null +++ b/spec/ApiClient/BioprotocolClientSpec.php @@ -0,0 +1,36 @@ +httpClient = $httpClient; + + $this->beConstructedWith($httpClient, ['X-Foo' => 'bar']); + } + + public function it_queries() + { + $request = new Request('GET', 'bioprotocol/article/12345', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.bioprotocol+json; version=1', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.bioprotocol+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->list(['Accept' => 'application/vnd.elife.bioprotocol+json; version=1'], 'article', '12345') + ->shouldBeLike($response); + } +} diff --git a/spec/ApiClient/BlogClientSpec.php b/spec/ApiClient/BlogClientSpec.php new file mode 100644 index 00000000..8dc7df12 --- /dev/null +++ b/spec/ApiClient/BlogClientSpec.php @@ -0,0 +1,52 @@ +httpClient = $httpClient; + + $this->beConstructedWith($httpClient, ['X-Foo' => 'bar']); + } + + public function it_gets_an_article() + { + $request = new Request('GET', 'blog-articles/3', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.blog-article+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.blog-article+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->getArticle(['Accept' => 'application/vnd.elife.blog-article+json; version=2'], '3') + ->shouldBeLike($response) + ; + } + + public function it_lists_articles() + { + $request = new Request('GET', 'blog-articles?page=1&per-page=20&order=desc&subject[]=cell-biology', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.blog-article-list+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.blog-article-list+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->listArticles(['Accept' => 'application/vnd.elife.blog-article-list+json; version=2'], + 1, 20, true, + ['cell-biology'])->shouldBeLike($response) + ; + } +} diff --git a/spec/ApiClient/CollectionsClientSpec.php b/spec/ApiClient/CollectionsClientSpec.php new file mode 100644 index 00000000..e47745d7 --- /dev/null +++ b/spec/ApiClient/CollectionsClientSpec.php @@ -0,0 +1,52 @@ +httpClient = $httpClient; + + $this->beConstructedWith($httpClient, ['X-Foo' => 'bar']); + } + + public function it_gets_a_collection() + { + $request = new Request('GET', 'collections/3', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.collection+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.collection+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->getCollection(['Accept' => 'application/vnd.elife.collection+json; version=2'], '3') + ->shouldBeLike($response) + ; + } + + public function it_lists_collections() + { + $request = new Request('GET', 'collections?page=1&per-page=20&order=desc&subject[]=cell-biology&containing[]=article/1234&containing[]=interview/5678', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.collection-list+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.collection-list+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->listCollections(['Accept' => 'application/vnd.elife.collection-list+json; version=2'], + 1, 20, true, + ['cell-biology'], ['article/1234', 'interview/5678'])->shouldBeLike($response) + ; + } +} diff --git a/spec/ApiClient/CommunityClientSpec.php b/spec/ApiClient/CommunityClientSpec.php new file mode 100644 index 00000000..d19a0ca9 --- /dev/null +++ b/spec/ApiClient/CommunityClientSpec.php @@ -0,0 +1,53 @@ +httpClient = $httpClient; + + $this->beConstructedWith($httpClient, ['X-Foo' => 'bar']); + } + + public function it_lists_several_content_types() + { + $request = new Request( + 'GET', + 'community?page=1&per-page=20&order=desc&subject[]=cell-biology', + [ + 'X-Foo' => 'bar', + 'Accept' => 'application/vnd.elife.community-list+json; version=2', + 'User-Agent' => 'eLifeApiClient/'.Version::get(), + ] + ); + $response = new FulfilledPromise(new ArrayResult( + new MediaType('application/vnd.elife.community-list+json', 2), + ['items' => ['bar', 'baz'], 'total' => 2] + )); + + $this->httpClient->send($request)->willReturn($response); + + $this + ->listContent( + ['Accept' => 'application/vnd.elife.community-list+json; version=2'], + 1, + 20, + true, + ['cell-biology'] + ) + ->shouldBeLike($response) + ; + } +} diff --git a/spec/ApiClient/CoversClientSpec.php b/spec/ApiClient/CoversClientSpec.php new file mode 100644 index 00000000..5d9e9e72 --- /dev/null +++ b/spec/ApiClient/CoversClientSpec.php @@ -0,0 +1,48 @@ +httpClient = $httpClient; + + $this->beConstructedWith($httpClient, ['X-Foo' => 'bar']); + } + + public function it_lists_covers() + { + $request = new Request('GET', 'covers?page=1&per-page=20&sort=page-views&order=desc&use-date=published&start-date=2017-01-02&end-date=2017-02-03', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.cover-list+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.cover-list+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->listCovers(['Accept' => 'application/vnd.elife.cover-list+json; version=2'], 1, 20, 'page-views', true, 'published', new DateTimeImmutable('2017-01-02'), new DateTimeImmutable('2017-02-03'))->shouldBeLike($response); + } + + public function it_lists_current_covers() + { + $request = new Request('GET', 'covers/current', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.cover-list+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.cover-list+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->listCurrentCovers(['Accept' => 'application/vnd.elife.cover-list+json; version=2'], 1, 20, true)->shouldBeLike($response); + } +} diff --git a/spec/ApiClient/DigestsClientSpec.php b/spec/ApiClient/DigestsClientSpec.php new file mode 100644 index 00000000..75ba139b --- /dev/null +++ b/spec/ApiClient/DigestsClientSpec.php @@ -0,0 +1,52 @@ +httpClient = $httpClient; + + $this->beConstructedWith($httpClient, ['X-Foo' => 'bar']); + } + + public function it_gets_a_digest() + { + $request = new Request('GET', 'digests/3', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.digest+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.digest+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->getDigest(['Accept' => 'application/vnd.elife.digest+json; version=2'], '3') + ->shouldBeLike($response) + ; + } + + public function it_lists_digests() + { + $request = new Request('GET', 'digests?page=1&per-page=20&order=desc', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.digest-list+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.digest-list+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->listDigests(['Accept' => 'application/vnd.elife.digest-list+json; version=2'], + 1, 20, true)->shouldBeLike($response) + ; + } +} diff --git a/spec/ApiClient/EventsClientSpec.php b/spec/ApiClient/EventsClientSpec.php new file mode 100644 index 00000000..8ef6cef2 --- /dev/null +++ b/spec/ApiClient/EventsClientSpec.php @@ -0,0 +1,49 @@ +httpClient = $httpClient; + + $this->beConstructedWith($httpClient, ['X-Foo' => 'bar']); + } + + public function it_gets_an_event() + { + $request = new Request('GET', 'events/3', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.event+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.event+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->getEvent(['Accept' => 'application/vnd.elife.event+json; version=2'], 3) + ->shouldBeLike($response); + } + + public function it_lists_events() + { + $request = new Request('GET', 'events?page=1&per-page=20&show=open&order=desc', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.event-list+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.event-list+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->listEvents(['Accept' => 'application/vnd.elife.event-list+json; version=2'], 1, 20, 'open', true) + ->shouldBeLike($response); + } +} diff --git a/spec/ApiClient/HighlightsClientSpec.php b/spec/ApiClient/HighlightsClientSpec.php new file mode 100644 index 00000000..947461bb --- /dev/null +++ b/spec/ApiClient/HighlightsClientSpec.php @@ -0,0 +1,36 @@ +httpClient = $httpClient; + + $this->beConstructedWith($httpClient, ['X-Foo' => 'bar']); + } + + public function it_lists_highlights() + { + $request = new Request('GET', 'highlights/list?page=1&per-page=20&order=desc', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.highlight-list+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.highlight-list+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->listHighlights(['Accept' => 'application/vnd.elife.highlight-list+json; version=2'], 'list', 1, 20, true) + ->shouldBeLike($response); + } +} diff --git a/spec/ApiClient/InterviewsClientSpec.php b/spec/ApiClient/InterviewsClientSpec.php new file mode 100644 index 00000000..1557b172 --- /dev/null +++ b/spec/ApiClient/InterviewsClientSpec.php @@ -0,0 +1,51 @@ +httpClient = $httpClient; + + $this->beConstructedWith($httpClient, ['X-Foo' => 'bar']); + } + + public function it_gets_an_interview() + { + $request = new Request('GET', 'interviews/3', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.interview+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.interview+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->getInterview(['Accept' => 'application/vnd.elife.interview+json; version=2'], '3') + ->shouldBeLike($response) + ; + } + + public function it_lists_interviews() + { + $request = new Request('GET', 'interviews?page=1&per-page=20&order=desc', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.interview-list+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.interview-list+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->listInterviews(['Accept' => 'application/vnd.elife.interview-list+json; version=2'], + 1, 20, true)->shouldBeLike($response) + ; + } +} diff --git a/spec/ApiClient/JobAdvertsClientSpec.php b/spec/ApiClient/JobAdvertsClientSpec.php new file mode 100644 index 00000000..ec14bfa1 --- /dev/null +++ b/spec/ApiClient/JobAdvertsClientSpec.php @@ -0,0 +1,49 @@ +httpClient = $httpClient; + + $this->beConstructedWith($httpClient, ['X-Foo' => 'bar']); + } + + public function it_gets_a_job_advert() + { + $request = new Request('GET', 'job-adverts/3', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.job-advert+json; version=1', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.job-advert+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->getJobAdvert(['Accept' => 'application/vnd.elife.job-advert+json; version=1'], 3) + ->shouldBeLike($response); + } + + public function it_lists_job_adverts() + { + $request = new Request('GET', 'job-adverts?page=1&per-page=20&show=open&order=desc', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.job-advert-list+json; version=1', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.job-advert-list+json+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->listJobAdverts(['Accept' => 'application/vnd.elife.job-advert-list+json; version=1'], 1, 20, 'open', true) + ->shouldBeLike($response); + } +} diff --git a/spec/ApiClient/LabsClientSpec.php b/spec/ApiClient/LabsClientSpec.php new file mode 100644 index 00000000..9e95e1ed --- /dev/null +++ b/spec/ApiClient/LabsClientSpec.php @@ -0,0 +1,51 @@ +httpClient = $httpClient; + + $this->beConstructedWith($httpClient, ['X-Foo' => 'bar']); + } + + public function it_gets_a_post() + { + $request = new Request('GET', 'labs-posts/3', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.labs-post+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.labs-post+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->getPost(['Accept' => 'application/vnd.elife.labs-post+json; version=2'], '3') + ->shouldBeLike($response) + ; + } + + public function it_lists_posts() + { + $request = new Request('GET', 'labs-posts?page=1&per-page=20&order=desc', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.labs-post-list+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.labs-post-list+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->listPosts(['Accept' => 'application/vnd.elife.labs-post-list+json; version=2']) + ->shouldBeLike($response) + ; + } +} diff --git a/spec/ApiClient/MetricsClientSpec.php b/spec/ApiClient/MetricsClientSpec.php new file mode 100644 index 00000000..ca2bb507 --- /dev/null +++ b/spec/ApiClient/MetricsClientSpec.php @@ -0,0 +1,62 @@ +httpClient = $httpClient; + + $this->beConstructedWith($httpClient, ['X-Foo' => 'bar']); + } + + public function it_gets_citations() + { + $request = new Request('GET', 'metrics/article/01234/citations', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.metric-citations+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.metric-citations+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->citations(['Accept' => 'application/vnd.elife.metric-citations+json; version=2'], 'article', '01234') + ->shouldBeLike($response); + } + + public function it_gets_downloads() + { + $request = new Request('GET', 'metrics/article/01234/downloads?by=month&page=1&per-page=20&order=desc', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.metric-time-period+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.metric-time-period+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->downloads(['Accept' => 'application/vnd.elife.metric-time-period+json; version=2'], 'article', '01234') + ->shouldBeLike($response); + } + + public function it_gets_page_views() + { + $request = new Request('GET', 'metrics/article/01234/page-views?by=month&page=1&per-page=20&order=desc', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.metric-time-period+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.metric-time-period+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->pageViews(['Accept' => 'application/vnd.elife.metric-time-period+json; version=2'], 'article', '01234') + ->shouldBeLike($response); + } +} diff --git a/spec/ApiClient/PeopleClientSpec.php b/spec/ApiClient/PeopleClientSpec.php new file mode 100644 index 00000000..f4f38b17 --- /dev/null +++ b/spec/ApiClient/PeopleClientSpec.php @@ -0,0 +1,51 @@ +httpClient = $httpClient; + + $this->beConstructedWith($httpClient, ['X-Foo' => 'bar']); + } + + public function it_gets_a_person() + { + $request = new Request('GET', 'people/fbloggs', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.person+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.person+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->getPerson(['Accept' => 'application/vnd.elife.person+json; version=2'], 'fbloggs') + ->shouldBeLike($response) + ; + } + + public function it_lists_people() + { + $request = new Request('GET', 'people?page=1&per-page=20&order=desc&subject[]=cell-biology&type[]=senior-editor', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.person-list+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.person-list+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->listPeople(['Accept' => 'application/vnd.elife.person-list+json; version=2'], 1, 20, true, + ['cell-biology'], ['senior-editor'])->shouldBeLike($response) + ; + } +} diff --git a/spec/ApiClient/PodcastClientSpec.php b/spec/ApiClient/PodcastClientSpec.php new file mode 100644 index 00000000..0f7b8c5a --- /dev/null +++ b/spec/ApiClient/PodcastClientSpec.php @@ -0,0 +1,51 @@ +httpClient = $httpClient; + + $this->beConstructedWith($httpClient, ['X-Foo' => 'bar']); + } + + public function it_gets_a_podcast_episode() + { + $request = new Request('GET', 'podcast-episodes/3', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.podcast-episode+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.podcast-episode+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->getEpisode(['Accept' => 'application/vnd.elife.podcast-episode+json; version=2'], 3) + ->shouldBeLike($response) + ; + } + + public function it_lists_episodes() + { + $request = new Request('GET', 'podcast-episodes?page=1&per-page=20&order=desc&containing[]=article/1234&containing[]=interview/5678', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.podcast-episode-list+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.podcast-episode-list+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->listEpisodes(['Accept' => 'application/vnd.elife.podcast-episode-list+json; version=2'], 1, 20, true, ['article/1234', 'interview/5678']) + ->shouldBeLike($response) + ; + } +} diff --git a/spec/ApiClient/PressPackagesClientSpec.php b/spec/ApiClient/PressPackagesClientSpec.php new file mode 100644 index 00000000..736467d8 --- /dev/null +++ b/spec/ApiClient/PressPackagesClientSpec.php @@ -0,0 +1,50 @@ +httpClient = $httpClient; + + $this->beConstructedWith($httpClient, ['X-Foo' => 'bar']); + } + + public function it_gets_a_package() + { + $request = new Request('GET', 'press-packages/3', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.press-package+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.press-package+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->getPackage(['Accept' => 'application/vnd.elife.press-package+json; version=2'], '3') + ->shouldBeLike($response); + } + + public function it_lists_packages() + { + $request = new Request('GET', 'press-packages?page=1&per-page=20&order=desc&subject[]=cell-biology', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.press-package-list+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.press-package-list+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->listPackages(['Accept' => 'application/vnd.elife.press-package-list+json; version=2'], + 1, 20, true, + ['cell-biology'])->shouldBeLike($response); + } +} diff --git a/spec/ApiClient/ProfilesClientSpec.php b/spec/ApiClient/ProfilesClientSpec.php new file mode 100644 index 00000000..9bbeb23e --- /dev/null +++ b/spec/ApiClient/ProfilesClientSpec.php @@ -0,0 +1,49 @@ +httpClient = $httpClient; + + $this->beConstructedWith($httpClient, ['X-Foo' => 'bar']); + } + + public function it_gets_a_profile() + { + $request = new Request('GET', 'profiles/fbloggs', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.profile+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.profile+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->getProfile(['Accept' => 'application/vnd.elife.profile+json; version=2'], 'fbloggs') + ->shouldBeLike($response); + } + + public function it_lists_profiles() + { + $request = new Request('GET', 'profiles?page=1&per-page=20&order=desc', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.profile-list+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.profile-list+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->listProfiles(['Accept' => 'application/vnd.elife.profile-list+json; version=2'], 1, 20, true) + ->shouldBeLike($response); + } +} diff --git a/spec/ApiClient/PromotionalCollectionsClientSpec.php b/spec/ApiClient/PromotionalCollectionsClientSpec.php new file mode 100644 index 00000000..024bec80 --- /dev/null +++ b/spec/ApiClient/PromotionalCollectionsClientSpec.php @@ -0,0 +1,53 @@ +httpClient = $httpClient; + + $this->beConstructedWith($httpClient, ['X-Foo' => 'bar']); + } + + public function it_gets_a_promotional_collection() + { + $request = new Request('GET', 'promotional-collections/3', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.promotional-collection+json; version=1', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.promotional-collection+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->getPromotionalCollection(['Accept' => 'application/vnd.elife.promotional-collection+json; version=1'], '3') + ->shouldBeLike($response) + ; + } + + public function it_lists_promotional_collections() + { + $request = new Request('GET', 'promotional-collections?page=1&per-page=20&order=desc&subject[]=cell-biology&containing[]=article/1234&containing[]=interview/5678', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.promotional-collection-list+json; version=1', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.promotional-collection-list+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->listPromotionalCollections( + ['Accept' => 'application/vnd.elife.promotional-collection-list+json; version=1'], + 1, 20, true, + ['cell-biology'], ['article/1234', 'interview/5678'] + )->shouldBeLike($response); + } +} diff --git a/spec/ApiClient/RecommendationsClientSpec.php b/spec/ApiClient/RecommendationsClientSpec.php new file mode 100644 index 00000000..ebb3081a --- /dev/null +++ b/spec/ApiClient/RecommendationsClientSpec.php @@ -0,0 +1,37 @@ +httpClient = $httpClient; + + $this->beConstructedWith($httpClient, ['X-Foo' => 'bar']); + } + + public function it_queries() + { + $request = new Request('GET', + 'recommendations/article/12345?page=1&per-page=20&order=desc', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.recommendations+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.recommendations+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->list((['Accept' => 'application/vnd.elife.recommendations+json; version=2']), 'article', '12345', 1, 20, true) + ->shouldBeLike($response); + } +} diff --git a/spec/ApiClient/ReviewedPreprintsClientSpec.php b/spec/ApiClient/ReviewedPreprintsClientSpec.php new file mode 100644 index 00000000..c0cf6e70 --- /dev/null +++ b/spec/ApiClient/ReviewedPreprintsClientSpec.php @@ -0,0 +1,53 @@ +httpClient = $httpClient; + + $this->beConstructedWith($httpClient, ['X-Foo' => 'bar']); + } + + public function it_gets_a_reviewed_preprint() + { + $request = new Request('GET', 'reviewed-preprints/3', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.reviewed-preprint+json; version=1', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.reviewed-preprint+json', + 1), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->getReviewedPreprint(['Accept' => 'application/vnd.elife.reviewed-preprint+json; version=1'], '3') + ->shouldBeLike($response) + ; + } + + public function it_lists_reviewed_preprints() + { + $request = new Request('GET', 'reviewed-preprints?page=1&per-page=20&order=desc&use-date=published&start-date=2017-01-02&end-date=2017-02-03', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.reviewed-preprint-list+json; version=1', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.reviewed-preprint-list+json', + 1), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->listReviewedPreprints(['Accept' => 'application/vnd.elife.reviewed-preprint-list+json; version=1'], + 1, 20, true, 'published', + new DateTimeImmutable('2017-01-02'), new DateTimeImmutable('2017-02-03'))->shouldBeLike($response) + ; + } +} diff --git a/spec/ApiClient/SearchClientSpec.php b/spec/ApiClient/SearchClientSpec.php new file mode 100644 index 00000000..77ae6673 --- /dev/null +++ b/spec/ApiClient/SearchClientSpec.php @@ -0,0 +1,55 @@ +httpClient = $httpClient; + + $this->beConstructedWith($httpClient, ['X-Foo' => 'bar']); + } + + public function it_queries() + { + $request = new Request('GET', + 'search?for=foo/%23%20bar&page=1&per-page=20&sort=date&order=desc&subject[]=cell-biology&type[]=research-article&use-date=published&start-date=2017-01-02&end-date=2017-02-03', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.search+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.search+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->query((['Accept' => 'application/vnd.elife.search+json; version=2']), 'foo/# bar', 1, 20, 'date', true, + ['cell-biology'], ['research-article'], 'published', new DateTimeImmutable('2017-01-02'), new DateTimeImmutable('2017-02-03')) + ->shouldBeLike($response) + ; + } + + public function it_always_queries_with_for() + { + $request = new Request('GET', + 'search?for=&page=1&per-page=20&sort=relevance&order=desc&use-date=default', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.search+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.search+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->query((['Accept' => 'application/vnd.elife.search+json; version=2'])) + ->shouldBeLike($response) + ; + } +} diff --git a/spec/ApiClient/SubjectsClientSpec.php b/spec/ApiClient/SubjectsClientSpec.php new file mode 100644 index 00000000..3895732d --- /dev/null +++ b/spec/ApiClient/SubjectsClientSpec.php @@ -0,0 +1,51 @@ +httpClient = $httpClient; + + $this->beConstructedWith($httpClient, ['X-Foo' => 'bar']); + } + + public function it_gets_a_subject() + { + $request = new Request('GET', 'subjects/cell-biology', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.subject+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.subject+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->getSubject(['Accept' => 'application/vnd.elife.subject+json; version=2'], 'cell-biology') + ->shouldBeLike($response) + ; + } + + public function it_lists_subjects() + { + $request = new Request('GET', 'subjects?page=1&per-page=20&order=desc', + ['X-Foo' => 'bar', 'Accept' => 'application/vnd.elife.subject-list+json; version=2', 'User-Agent' => 'eLifeApiClient/'.Version::get()]); + $response = new FulfilledPromise(new ArrayResult(new MediaType('application/vnd.elife.subject-list+json', + 2), ['foo' => ['bar', 'baz']])); + + $this->httpClient->send($request)->willReturn($response); + + $this->listSubjects(['Accept' => 'application/vnd.elife.subject-list+json; version=2']) + ->shouldBeLike($response) + ; + } +} diff --git a/src/ApiClient/AnnotationsClient.php b/src/ApiClient/AnnotationsClient.php new file mode 100644 index 00000000..9aa42f98 --- /dev/null +++ b/src/ApiClient/AnnotationsClient.php @@ -0,0 +1,38 @@ +getRequest( + $this->createUri([ + 'path' => 'annotations', + 'query' => [ + 'by' => $by, + 'page' => $page, + 'per-page' => $perPage, + 'order' => $descendingOrder ? 'desc' : 'asc', + 'use-date' => $useDate, + 'access' => $access, + ], + ]), + $headers + ); + } +} diff --git a/src/ApiClient/AnnualReportsClient.php b/src/ApiClient/AnnualReportsClient.php new file mode 100644 index 00000000..f695e827 --- /dev/null +++ b/src/ApiClient/AnnualReportsClient.php @@ -0,0 +1,38 @@ +getRequest($this->createUri(['path' => "annual-reports/$year"]), $headers); + } + + public function listReports( + array $headers = [], + int $page = 1, + int $perPage = 20, + bool $descendingOrder = true + ) : PromiseInterface { + return $this->getRequest( + $this->createUri([ + 'path' => 'annual-reports', + 'query' => [ + 'page' => $page, + 'per-page' => $perPage, + 'order' => $descendingOrder ? 'desc' : 'asc', + ], + ]), + $headers + ); + } +} diff --git a/src/ApiClient/ArticlesClient.php b/src/ApiClient/ArticlesClient.php new file mode 100644 index 00000000..64adea73 --- /dev/null +++ b/src/ApiClient/ArticlesClient.php @@ -0,0 +1,58 @@ +getRequest($this->createUri(['path' => "articles/$number"]), $headers); + } + + public function getArticleHistory(array $headers, string $number) : PromiseInterface + { + return $this->getRequest($this->createUri(['path' => "articles/$number/versions"]), $headers); + } + + public function getRelatedArticles(array $headers, string $number) : PromiseInterface + { + return $this->getRequest($this->createUri(['path' => "articles/$number/related"]), $headers); + } + + public function getArticleVersion(array $headers, string $number, int $version) : PromiseInterface + { + return $this->getRequest($this->createUri(['path' => "articles/$number/versions/$version"]), $headers); + } + + public function listArticles( + array $headers = [], + int $page = 1, + int $perPage = 20, + bool $descendingOrder = true, + array $subjects = [] + ) : PromiseInterface { + return $this->getRequest( + $this->createUri([ + 'path' => 'articles', + 'query' => [ + 'page' => $page, + 'per-page' => $perPage, + 'order' => $descendingOrder ? 'desc' : 'asc', + 'subject[]' => $subjects, + ], + ]), + $headers + ); + } +} diff --git a/src/ApiClient/BioprotocolClient.php b/src/ApiClient/BioprotocolClient.php new file mode 100644 index 00000000..8de9d997 --- /dev/null +++ b/src/ApiClient/BioprotocolClient.php @@ -0,0 +1,26 @@ +getRequest( + $this->createUri([ + 'path' => "bioprotocol/$type/$id", + ]), + $headers + ); + } +} diff --git a/src/ApiClient/BlogClient.php b/src/ApiClient/BlogClient.php new file mode 100644 index 00000000..167e91f8 --- /dev/null +++ b/src/ApiClient/BlogClient.php @@ -0,0 +1,40 @@ +getRequest($this->createUri(['path' => "blog-articles/$id"]), $headers); + } + + public function listArticles( + array $headers = [], + int $page = 1, + int $perPage = 20, + bool $descendingOrder = true, + array $subjects = [] + ) : PromiseInterface { + return $this->getRequest( + $this->createUri([ + 'path' => 'blog-articles', + 'query' => [ + 'page' => $page, + 'per-page' => $perPage, + 'order' => $descendingOrder ? 'desc' : 'asc', + 'subject[]' => $subjects, + ], + ]), + $headers + ); + } +} diff --git a/src/ApiClient/CollectionsClient.php b/src/ApiClient/CollectionsClient.php new file mode 100644 index 00000000..f899cbe9 --- /dev/null +++ b/src/ApiClient/CollectionsClient.php @@ -0,0 +1,42 @@ +getRequest($this->createUri(['path' => "collections/$id"]), $headers); + } + + public function listCollections( + array $headers = [], + int $page = 1, + int $perPage = 20, + bool $descendingOrder = true, + array $subjects = [], + array $containing = [] + ) : PromiseInterface { + return $this->getRequest( + $this->createUri([ + 'path' => 'collections', + 'query' => [ + 'page' => $page, + 'per-page' => $perPage, + 'order' => $descendingOrder ? 'desc' : 'asc', + 'subject[]' => $subjects, + 'containing[]' => $containing, + ], + ]), + $headers + ); + } +} diff --git a/src/ApiClient/CommunityClient.php b/src/ApiClient/CommunityClient.php new file mode 100644 index 00000000..126363e8 --- /dev/null +++ b/src/ApiClient/CommunityClient.php @@ -0,0 +1,34 @@ +getRequest( + $this->createUri([ + 'path' => 'community', + 'query' => [ + 'page' => $page, + 'per-page' => $perPage, + 'order' => $descendingOrder ? 'desc' : 'asc', + 'subject[]' => $subjects, + ], + ]), + $headers + ); + } +} diff --git a/src/ApiClient/CoversClient.php b/src/ApiClient/CoversClient.php new file mode 100644 index 00000000..3163865f --- /dev/null +++ b/src/ApiClient/CoversClient.php @@ -0,0 +1,46 @@ +getRequest( + $this->createUri([ + 'path' => 'covers', + 'query' => [ + 'page' => $page, + 'per-page' => $perPage, + 'sort' => $sort, + 'order' => $descendingOrder ? 'desc' : 'asc', + 'use-date' => $useDate, + 'start-date' => $starts ? $starts->format('Y-m-d') : null, + 'end-date' => $ends ? $ends->format('Y-m-d') : null, + ], + ]), + $headers + ); + } + + public function listCurrentCovers(array $headers = []) : PromiseInterface + { + return $this->getRequest($this->createUri(['path' => 'covers/current']), $headers); + } +} diff --git a/src/ApiClient/DigestsClient.php b/src/ApiClient/DigestsClient.php new file mode 100644 index 00000000..9e2744f8 --- /dev/null +++ b/src/ApiClient/DigestsClient.php @@ -0,0 +1,38 @@ +getRequest($this->createUri(['path' => "digests/$id"]), $headers); + } + + public function listDigests( + array $headers = [], + int $page = 1, + int $perPage = 20, + bool $descendingOrder = true + ) : PromiseInterface { + return $this->getRequest( + $this->createUri([ + 'path' => 'digests', + 'query' => [ + 'page' => $page, + 'per-page' => $perPage, + 'order' => $descendingOrder ? 'desc' : 'asc', + ], + ]), + $headers + ); + } +} diff --git a/src/ApiClient/EventsClient.php b/src/ApiClient/EventsClient.php new file mode 100644 index 00000000..3ba663f5 --- /dev/null +++ b/src/ApiClient/EventsClient.php @@ -0,0 +1,40 @@ +getRequest($this->createUri(['path' => "events/$id"]), $headers); + } + + public function listEvents( + array $headers = [], + int $page = 1, + int $perPage = 20, + string $show = 'all', + bool $descendingOrder = true + ) : PromiseInterface { + return $this->getRequest( + $this->createUri([ + 'path' => 'events', + 'query' => [ + 'page' => $page, + 'per-page' => $perPage, + 'show' => $show, + 'order' => $descendingOrder ? 'desc' : 'asc', + ], + ]), + $headers + ); + } +} diff --git a/src/ApiClient/HighlightsClient.php b/src/ApiClient/HighlightsClient.php new file mode 100644 index 00000000..6c929aec --- /dev/null +++ b/src/ApiClient/HighlightsClient.php @@ -0,0 +1,33 @@ +getRequest( + $this->createUri([ + 'path' => "highlights/$id", + 'query' => [ + 'page' => $page, + 'per-page' => $perPage, + 'order' => $descendingOrder ? 'desc' : 'asc', + ], + ]), + $headers + ); + } +} diff --git a/src/ApiClient/InterviewsClient.php b/src/ApiClient/InterviewsClient.php new file mode 100644 index 00000000..c1fff21e --- /dev/null +++ b/src/ApiClient/InterviewsClient.php @@ -0,0 +1,38 @@ +getRequest($this->createUri(['path' => "interviews/$id"]), $headers); + } + + public function listInterviews( + array $headers = [], + int $page = 1, + int $perPage = 20, + bool $descendingOrder = true + ) : PromiseInterface { + return $this->getRequest( + $this->createUri([ + 'path' => 'interviews', + 'query' => [ + 'page' => $page, + 'per-page' => $perPage, + 'order' => $descendingOrder ? 'desc' : 'asc', + ], + ]), + $headers + ); + } +} diff --git a/src/ApiClient/JobAdvertsClient.php b/src/ApiClient/JobAdvertsClient.php new file mode 100644 index 00000000..93710079 --- /dev/null +++ b/src/ApiClient/JobAdvertsClient.php @@ -0,0 +1,43 @@ +getRequest( + $this->createUri(['path' => "job-adverts/$id"]), + $headers + ); + } + + public function listJobAdverts( + array $headers = [], + int $page = 1, + int $perPage = 20, + string $show = 'all', + bool $descendingOrder = true + ) : PromiseInterface { + return $this->getRequest( + $this->createUri([ + 'path' => 'job-adverts', + 'query' => [ + 'page' => $page, + 'per-page' => $perPage, + 'show' => $show, + 'order' => $descendingOrder ? 'desc' : 'asc', + ], + ]), + $headers + ); + } +} diff --git a/src/ApiClient/LabsClient.php b/src/ApiClient/LabsClient.php new file mode 100644 index 00000000..961d9bd9 --- /dev/null +++ b/src/ApiClient/LabsClient.php @@ -0,0 +1,41 @@ +getRequest( + $this->createUri(['path' => "labs-posts/$id"]), + $headers + ); + } + + public function listPosts( + array $headers = [], + int $page = 1, + int $perPage = 20, + bool $descendingOrder = true + ) : PromiseInterface { + return $this->getRequest( + $this->createUri([ + 'path' => 'labs-posts', + 'query' => [ + 'page' => $page, + 'per-page' => $perPage, + 'order' => $descendingOrder ? 'desc' : 'asc', + ], + ]), + $headers + ); + } +} diff --git a/src/ApiClient/MetricsClient.php b/src/ApiClient/MetricsClient.php new file mode 100644 index 00000000..d1c6f4cf --- /dev/null +++ b/src/ApiClient/MetricsClient.php @@ -0,0 +1,63 @@ +getRequest($this->createUri(['path' => "metrics/$type/$id/citations"]), $headers); + } + + public function downloads( + array $headers, + string $type, + string $id, + string $by = 'month', + int $page = 1, + int $perPage = 20, + bool $descendingOrder = true + ) : PromiseInterface { + return $this->getRequest( + $this->createUri([ + 'path' => "metrics/$type/$id/downloads", + 'query' => [ + 'by' => $by, + 'page' => $page, + 'per-page' => $perPage, + 'order' => $descendingOrder ? 'desc' : 'asc', + ], + ]), + $headers); + } + + public function pageViews( + array $headers, + string $type, + string $id, + string $by = 'month', + int $page = 1, + int $perPage = 20, + bool $descendingOrder = true + ) : PromiseInterface { + return $this->getRequest( + $this->createUri([ + 'path' => "metrics/$type/$id/page-views", + 'query' => [ + 'by' => $by, + 'page' => $page, + 'per-page' => $perPage, + 'order' => $descendingOrder ? 'desc' : 'asc', + ], + ]), + $headers); + } +} diff --git a/src/ApiClient/PeopleClient.php b/src/ApiClient/PeopleClient.php new file mode 100644 index 00000000..ab5484af --- /dev/null +++ b/src/ApiClient/PeopleClient.php @@ -0,0 +1,42 @@ +getRequest($this->createUri(['path' => "people/$id"]), $headers); + } + + public function listPeople( + array $headers = [], + int $page = 1, + int $perPage = 20, + bool $descendingOrder = true, + array $subjects = [], + array $types = [] + ) : PromiseInterface { + return $this->getRequest( + $this->createUri([ + 'path' => 'people', + 'query' => [ + 'page' => $page, + 'per-page' => $perPage, + 'order' => $descendingOrder ? 'desc' : 'asc', + 'subject[]' => $subjects, + 'type[]' => $types, + ], + ]), + $headers + ); + } +} diff --git a/src/ApiClient/PodcastClient.php b/src/ApiClient/PodcastClient.php new file mode 100644 index 00000000..d3458aef --- /dev/null +++ b/src/ApiClient/PodcastClient.php @@ -0,0 +1,40 @@ +getRequest($this->createUri(['path' => "podcast-episodes/$number"]), $headers); + } + + public function listEpisodes( + array $headers = [], + int $page = 1, + int $perPage = 20, + bool $descendingOrder = true, + array $containing = [] + ) : PromiseInterface { + return $this->getRequest( + $this->createUri([ + 'path' => 'podcast-episodes', + 'query' => [ + 'page' => $page, + 'per-page' => $perPage, + 'order' => $descendingOrder ? 'desc' : 'asc', + 'containing[]' => $containing, + ], + ]), + $headers + ); + } +} diff --git a/src/ApiClient/PressPackagesClient.php b/src/ApiClient/PressPackagesClient.php new file mode 100644 index 00000000..0978239c --- /dev/null +++ b/src/ApiClient/PressPackagesClient.php @@ -0,0 +1,40 @@ +getRequest($this->createUri(['path' => "press-packages/$id"]), $headers); + } + + public function listPackages( + array $headers = [], + int $page = 1, + int $perPage = 20, + bool $descendingOrder = true, + array $subjects = [] + ) : PromiseInterface { + return $this->getRequest( + $this->createUri([ + 'path' => 'press-packages', + 'query' => [ + 'page' => $page, + 'per-page' => $perPage, + 'order' => $descendingOrder ? 'desc' : 'asc', + 'subject[]' => $subjects, + ], + ]), + $headers + ); + } +} diff --git a/src/ApiClient/ProfilesClient.php b/src/ApiClient/ProfilesClient.php new file mode 100644 index 00000000..fbe30922 --- /dev/null +++ b/src/ApiClient/ProfilesClient.php @@ -0,0 +1,38 @@ +getRequest($this->createUri(['path' => "profiles/$id"]), $headers); + } + + public function listProfiles( + array $headers = [], + int $page = 1, + int $perPage = 20, + bool $descendingOrder = true + ) : PromiseInterface { + return $this->getRequest( + $this->createUri([ + 'path' => 'profiles', + 'query' => [ + 'page' => $page, + 'per-page' => $perPage, + 'order' => $descendingOrder ? 'desc' : 'asc', + ], + ]), + $headers + ); + } +} diff --git a/src/ApiClient/PromotionalCollectionsClient.php b/src/ApiClient/PromotionalCollectionsClient.php new file mode 100644 index 00000000..f512a302 --- /dev/null +++ b/src/ApiClient/PromotionalCollectionsClient.php @@ -0,0 +1,42 @@ +getRequest($this->createUri(['path' => "promotional-collections/$id"]), $headers); + } + + public function listPromotionalCollections( + array $headers = [], + int $page = 1, + int $perPage = 20, + bool $descendingOrder = true, + array $subjects = [], + array $containing = [] + ) : PromiseInterface { + return $this->getRequest( + $this->createUri([ + 'path' => 'promotional-collections', + 'query' => [ + 'page' => $page, + 'per-page' => $perPage, + 'order' => $descendingOrder ? 'desc' : 'asc', + 'subject[]' => $subjects, + 'containing[]' => $containing, + ], + ]), + $headers + ); + } +} diff --git a/src/ApiClient/RecommendationsClient.php b/src/ApiClient/RecommendationsClient.php new file mode 100644 index 00000000..342bd4fa --- /dev/null +++ b/src/ApiClient/RecommendationsClient.php @@ -0,0 +1,34 @@ +getRequest( + $this->createUri([ + 'path' => "recommendations/$type/$id", + 'query' => [ + 'page' => $page, + 'per-page' => $perPage, + 'order' => $descendingOrder ? 'desc' : 'asc', + ], + ]), + $headers + ); + } +} diff --git a/src/ApiClient/ReviewedPreprintsClient.php b/src/ApiClient/ReviewedPreprintsClient.php new file mode 100644 index 00000000..9f430502 --- /dev/null +++ b/src/ApiClient/ReviewedPreprintsClient.php @@ -0,0 +1,45 @@ +getRequest($this->createUri(['path' => "reviewed-preprints/$id"]), $headers); + } + + public function listReviewedPreprints( + array $headers = [], + int $page = 1, + int $perPage = 20, + bool $descendingOrder = true, + string $useDate = 'default', + DateTimeImmutable $starts = null, + DateTimeImmutable $ends = null + ) : PromiseInterface { + return $this->getRequest( + $this->createUri([ + 'path' => 'reviewed-preprints', + 'query' => [ + 'page' => $page, + 'per-page' => $perPage, + 'order' => $descendingOrder ? 'desc' : 'asc', + 'use-date' => $useDate, + 'start-date' => $starts ? $starts->format('Y-m-d') : null, + 'end-date' => $ends ? $ends->format('Y-m-d') : null, + ], + ]), + $headers + ); + } +} diff --git a/src/ApiClient/SearchClient.php b/src/ApiClient/SearchClient.php new file mode 100644 index 00000000..606f96f7 --- /dev/null +++ b/src/ApiClient/SearchClient.php @@ -0,0 +1,51 @@ +createUri([ + 'path' => 'search', + 'query' => [ + 'for' => $query, + 'page' => $page, + 'per-page' => $perPage, + 'sort' => $sort, + 'order' => $descendingOrder ? 'desc' : 'asc', + 'subject[]' => $subjects, + 'type[]' => $types, + 'use-date' => $useDate, + 'start-date' => $starts ? $starts->format('Y-m-d') : null, + 'end-date' => $ends ? $ends->format('Y-m-d') : null, + ], + ]); + + if (!isset(parse_query($uri->getQuery())['for'])) { + $uri = $uri->withQuery('for=&'.$uri->getQuery()); + } + + return $this->getRequest($uri, $headers); + } +} diff --git a/src/ApiClient/SubjectsClient.php b/src/ApiClient/SubjectsClient.php new file mode 100644 index 00000000..2a3a72c0 --- /dev/null +++ b/src/ApiClient/SubjectsClient.php @@ -0,0 +1,38 @@ +getRequest($this->createUri(['path' => "subjects/$id"]), $headers); + } + + public function listSubjects( + array $headers = [], + int $page = 1, + int $perPage = 20, + bool $descendingOrder = true + ) : PromiseInterface { + return $this->getRequest( + $this->createUri([ + 'path' => 'subjects', + 'query' => [ + 'page' => $page, + 'per-page' => $perPage, + 'order' => $descendingOrder ? 'desc' : 'asc', + ], + ]), + $headers + ); + } +} diff --git a/src/ApiSdk.php b/src/ApiSdk.php index 9d6291e9..b1085f03 100644 --- a/src/ApiSdk.php +++ b/src/ApiSdk.php @@ -2,30 +2,30 @@ namespace eLife\ApiSdk; -use eLife\ApiClient\ApiClient\AnnotationsClient; -use eLife\ApiClient\ApiClient\AnnualReportsClient; -use eLife\ApiClient\ApiClient\ArticlesClient; -use eLife\ApiClient\ApiClient\BioprotocolClient; -use eLife\ApiClient\ApiClient\BlogClient; -use eLife\ApiClient\ApiClient\CollectionsClient; -use eLife\ApiClient\ApiClient\CommunityClient; -use eLife\ApiClient\ApiClient\CoversClient; -use eLife\ApiClient\ApiClient\DigestsClient; -use eLife\ApiClient\ApiClient\EventsClient; -use eLife\ApiClient\ApiClient\HighlightsClient; -use eLife\ApiClient\ApiClient\InterviewsClient; -use eLife\ApiClient\ApiClient\JobAdvertsClient; -use eLife\ApiClient\ApiClient\LabsClient; -use eLife\ApiClient\ApiClient\MetricsClient; -use eLife\ApiClient\ApiClient\PeopleClient; -use eLife\ApiClient\ApiClient\PodcastClient; -use eLife\ApiClient\ApiClient\PressPackagesClient; -use eLife\ApiClient\ApiClient\ProfilesClient; -use eLife\ApiClient\ApiClient\PromotionalCollectionsClient; -use eLife\ApiClient\ApiClient\RecommendationsClient; -use eLife\ApiClient\ApiClient\ReviewedPreprintsClient; -use eLife\ApiClient\ApiClient\SearchClient; -use eLife\ApiClient\ApiClient\SubjectsClient; +use eLife\ApiSdk\ApiClient\AnnotationsClient; +use eLife\ApiSdk\ApiClient\AnnualReportsClient; +use eLife\ApiSdk\ApiClient\ArticlesClient; +use eLife\ApiSdk\ApiClient\BioprotocolClient; +use eLife\ApiSdk\ApiClient\BlogClient; +use eLife\ApiSdk\ApiClient\CollectionsClient; +use eLife\ApiSdk\ApiClient\CommunityClient; +use eLife\ApiSdk\ApiClient\CoversClient; +use eLife\ApiSdk\ApiClient\DigestsClient; +use eLife\ApiSdk\ApiClient\EventsClient; +use eLife\ApiSdk\ApiClient\HighlightsClient; +use eLife\ApiSdk\ApiClient\InterviewsClient; +use eLife\ApiSdk\ApiClient\JobAdvertsClient; +use eLife\ApiSdk\ApiClient\LabsClient; +use eLife\ApiSdk\ApiClient\MetricsClient; +use eLife\ApiSdk\ApiClient\PeopleClient; +use eLife\ApiSdk\ApiClient\PodcastClient; +use eLife\ApiSdk\ApiClient\PressPackagesClient; +use eLife\ApiSdk\ApiClient\ProfilesClient; +use eLife\ApiSdk\ApiClient\PromotionalCollectionsClient; +use eLife\ApiSdk\ApiClient\RecommendationsClient; +use eLife\ApiSdk\ApiClient\ReviewedPreprintsClient; +use eLife\ApiSdk\ApiClient\SearchClient; +use eLife\ApiSdk\ApiClient\SubjectsClient; use eLife\ApiClient\HttpClient; use eLife\ApiClient\HttpClient\UserAgentPrependingHttpClient; use eLife\ApiSdk\Client\Annotations; diff --git a/src/Client/Annotations.php b/src/Client/Annotations.php index b95b029b..eb836d4c 100644 --- a/src/Client/Annotations.php +++ b/src/Client/Annotations.php @@ -2,7 +2,7 @@ namespace eLife\ApiSdk\Client; -use eLife\ApiClient\ApiClient\AnnotationsClient; +use eLife\ApiSdk\ApiClient\AnnotationsClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\Collection\ArraySequence; diff --git a/src/Client/AnnualReports.php b/src/Client/AnnualReports.php index 20d00b27..cb9e083f 100644 --- a/src/Client/AnnualReports.php +++ b/src/Client/AnnualReports.php @@ -2,7 +2,7 @@ namespace eLife\ApiSdk\Client; -use eLife\ApiClient\ApiClient\AnnualReportsClient; +use eLife\ApiSdk\ApiClient\AnnualReportsClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\Collection\PromiseSequence; diff --git a/src/Client/Articles.php b/src/Client/Articles.php index 71b4a144..375f6d6c 100644 --- a/src/Client/Articles.php +++ b/src/Client/Articles.php @@ -2,7 +2,7 @@ namespace eLife\ApiSdk\Client; -use eLife\ApiClient\ApiClient\ArticlesClient; +use eLife\ApiSdk\ApiClient\ArticlesClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\Collection\PromiseSequence; diff --git a/src/Client/Bioprotocols.php b/src/Client/Bioprotocols.php index 5ab75a8d..06bbda48 100644 --- a/src/Client/Bioprotocols.php +++ b/src/Client/Bioprotocols.php @@ -2,7 +2,7 @@ namespace eLife\ApiSdk\Client; -use eLife\ApiClient\ApiClient\BioprotocolClient; +use eLife\ApiSdk\ApiClient\BioprotocolClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\Model\Bioprotocol; diff --git a/src/Client/BlogArticles.php b/src/Client/BlogArticles.php index f5ee6d2d..980d8d0c 100644 --- a/src/Client/BlogArticles.php +++ b/src/Client/BlogArticles.php @@ -2,7 +2,7 @@ namespace eLife\ApiSdk\Client; -use eLife\ApiClient\ApiClient\BlogClient; +use eLife\ApiSdk\ApiClient\BlogClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\Collection\PromiseSequence; diff --git a/src/Client/Collections.php b/src/Client/Collections.php index 3060d4ba..7d79c6fb 100644 --- a/src/Client/Collections.php +++ b/src/Client/Collections.php @@ -2,7 +2,7 @@ namespace eLife\ApiSdk\Client; -use eLife\ApiClient\ApiClient\CollectionsClient; +use eLife\ApiSdk\ApiClient\CollectionsClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\Collection\PromiseSequence; diff --git a/src/Client/Community.php b/src/Client/Community.php index cae5e89e..2a27b9f0 100644 --- a/src/Client/Community.php +++ b/src/Client/Community.php @@ -2,7 +2,7 @@ namespace eLife\ApiSdk\Client; -use eLife\ApiClient\ApiClient\CommunityClient; +use eLife\ApiSdk\ApiClient\CommunityClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\Collection\PromiseSequence; diff --git a/src/Client/Covers.php b/src/Client/Covers.php index 7c90b391..9961eece 100644 --- a/src/Client/Covers.php +++ b/src/Client/Covers.php @@ -3,7 +3,7 @@ namespace eLife\ApiSdk\Client; use DateTimeImmutable; -use eLife\ApiClient\ApiClient\CoversClient; +use eLife\ApiSdk\ApiClient\CoversClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\Collection\ArraySequence; diff --git a/src/Client/Digests.php b/src/Client/Digests.php index a4857974..580a8342 100644 --- a/src/Client/Digests.php +++ b/src/Client/Digests.php @@ -3,7 +3,7 @@ namespace eLife\ApiSdk\Client; use function array_map; -use eLife\ApiClient\ApiClient\DigestsClient; +use eLife\ApiSdk\ApiClient\DigestsClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\Collection\PromiseSequence; diff --git a/src/Client/Events.php b/src/Client/Events.php index e5d9a85e..3577488a 100644 --- a/src/Client/Events.php +++ b/src/Client/Events.php @@ -3,7 +3,7 @@ namespace eLife\ApiSdk\Client; use ArrayObject; -use eLife\ApiClient\ApiClient\EventsClient; +use eLife\ApiSdk\ApiClient\EventsClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\Collection\PromiseSequence; diff --git a/src/Client/Highlights.php b/src/Client/Highlights.php index f45902af..9ec53df1 100644 --- a/src/Client/Highlights.php +++ b/src/Client/Highlights.php @@ -2,7 +2,7 @@ namespace eLife\ApiSdk\Client; -use eLife\ApiClient\ApiClient\HighlightsClient; +use eLife\ApiSdk\ApiClient\HighlightsClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\Collection\PromiseSequence; diff --git a/src/Client/Interviews.php b/src/Client/Interviews.php index 7450ab59..b3a21f39 100644 --- a/src/Client/Interviews.php +++ b/src/Client/Interviews.php @@ -2,7 +2,7 @@ namespace eLife\ApiSdk\Client; -use eLife\ApiClient\ApiClient\InterviewsClient; +use eLife\ApiSdk\ApiClient\InterviewsClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\Collection\PromiseSequence; diff --git a/src/Client/JobAdverts.php b/src/Client/JobAdverts.php index f4c76e34..6da1c21b 100644 --- a/src/Client/JobAdverts.php +++ b/src/Client/JobAdverts.php @@ -2,7 +2,7 @@ namespace eLife\ApiSdk\Client; -use eLife\ApiClient\ApiClient\JobAdvertsClient; +use eLife\ApiSdk\ApiClient\JobAdvertsClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\Collection\PromiseSequence; diff --git a/src/Client/LabsPosts.php b/src/Client/LabsPosts.php index dfd7012e..540547e4 100644 --- a/src/Client/LabsPosts.php +++ b/src/Client/LabsPosts.php @@ -2,7 +2,7 @@ namespace eLife\ApiSdk\Client; -use eLife\ApiClient\ApiClient\LabsClient; +use eLife\ApiSdk\ApiClient\LabsClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\Collection\PromiseSequence; diff --git a/src/Client/Metrics.php b/src/Client/Metrics.php index 3c88ce14..719f5280 100644 --- a/src/Client/Metrics.php +++ b/src/Client/Metrics.php @@ -2,7 +2,7 @@ namespace eLife\ApiSdk\Client; -use eLife\ApiClient\ApiClient\MetricsClient; +use eLife\ApiSdk\ApiClient\MetricsClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\Model\CitationsMetric; diff --git a/src/Client/People.php b/src/Client/People.php index 01f8a513..2221a7b1 100644 --- a/src/Client/People.php +++ b/src/Client/People.php @@ -2,7 +2,7 @@ namespace eLife\ApiSdk\Client; -use eLife\ApiClient\ApiClient\PeopleClient; +use eLife\ApiSdk\ApiClient\PeopleClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\Collection\PromiseSequence; diff --git a/src/Client/PodcastEpisodes.php b/src/Client/PodcastEpisodes.php index 70c3b825..692ee944 100644 --- a/src/Client/PodcastEpisodes.php +++ b/src/Client/PodcastEpisodes.php @@ -2,7 +2,7 @@ namespace eLife\ApiSdk\Client; -use eLife\ApiClient\ApiClient\PodcastClient; +use eLife\ApiSdk\ApiClient\PodcastClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\Collection\ArraySequence; diff --git a/src/Client/PressPackages.php b/src/Client/PressPackages.php index 7c4d4ada..1f707912 100644 --- a/src/Client/PressPackages.php +++ b/src/Client/PressPackages.php @@ -2,7 +2,7 @@ namespace eLife\ApiSdk\Client; -use eLife\ApiClient\ApiClient\PressPackagesClient; +use eLife\ApiSdk\ApiClient\PressPackagesClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\Collection\PromiseSequence; diff --git a/src/Client/Profiles.php b/src/Client/Profiles.php index c4b36cb2..4ef9ac1c 100644 --- a/src/Client/Profiles.php +++ b/src/Client/Profiles.php @@ -2,7 +2,7 @@ namespace eLife\ApiSdk\Client; -use eLife\ApiClient\ApiClient\ProfilesClient; +use eLife\ApiSdk\ApiClient\ProfilesClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\Collection\PromiseSequence; diff --git a/src/Client/PromotionalCollections.php b/src/Client/PromotionalCollections.php index 900234a4..266321e2 100644 --- a/src/Client/PromotionalCollections.php +++ b/src/Client/PromotionalCollections.php @@ -2,7 +2,7 @@ namespace eLife\ApiSdk\Client; -use eLife\ApiClient\ApiClient\PromotionalCollectionsClient; +use eLife\ApiSdk\ApiClient\PromotionalCollectionsClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\Collection\PromiseSequence; diff --git a/src/Client/Recommendations.php b/src/Client/Recommendations.php index fe0150e4..e20d5dd8 100644 --- a/src/Client/Recommendations.php +++ b/src/Client/Recommendations.php @@ -2,7 +2,7 @@ namespace eLife\ApiSdk\Client; -use eLife\ApiClient\ApiClient\RecommendationsClient; +use eLife\ApiSdk\ApiClient\RecommendationsClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\Collection\PromiseSequence; diff --git a/src/Client/ReviewedPreprints.php b/src/Client/ReviewedPreprints.php index b21bd393..078ea0f8 100644 --- a/src/Client/ReviewedPreprints.php +++ b/src/Client/ReviewedPreprints.php @@ -3,7 +3,7 @@ namespace eLife\ApiSdk\Client; use DateTimeImmutable; -use eLife\ApiClient\ApiClient\ReviewedPreprintsClient; +use eLife\ApiSdk\ApiClient\ReviewedPreprintsClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\Collection; diff --git a/src/Client/Search.php b/src/Client/Search.php index cc90e133..7362f094 100644 --- a/src/Client/Search.php +++ b/src/Client/Search.php @@ -3,7 +3,7 @@ namespace eLife\ApiSdk\Client; use DateTimeImmutable; -use eLife\ApiClient\ApiClient\SearchClient; +use eLife\ApiSdk\ApiClient\SearchClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\Collection\PromiseSequence; diff --git a/src/Client/Subjects.php b/src/Client/Subjects.php index daa4c2d7..461852f9 100644 --- a/src/Client/Subjects.php +++ b/src/Client/Subjects.php @@ -2,7 +2,7 @@ namespace eLife\ApiSdk\Client; -use eLife\ApiClient\ApiClient\SubjectsClient; +use eLife\ApiSdk\ApiClient\SubjectsClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\Collection\PromiseSequence; diff --git a/src/Serializer/ArticleVersionNormalizer.php b/src/Serializer/ArticleVersionNormalizer.php index efa1f311..4b574c11 100644 --- a/src/Serializer/ArticleVersionNormalizer.php +++ b/src/Serializer/ArticleVersionNormalizer.php @@ -3,7 +3,7 @@ namespace eLife\ApiSdk\Serializer; use DateTimeImmutable; -use eLife\ApiClient\ApiClient\ArticlesClient; +use eLife\ApiSdk\ApiClient\ArticlesClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\ApiSdk; @@ -392,7 +392,7 @@ final public function normalize($object, $format = null, array $context = []) : 'id' => $award->getId(), 'source' => $source, ]; - + if ($award->getRecipients()->notEmpty()) { $data['recipients'] = $award->getRecipients() ->map(function (Author $author) use ($format, $context) { diff --git a/src/Serializer/BlogArticleNormalizer.php b/src/Serializer/BlogArticleNormalizer.php index 358ad9f5..be66e230 100644 --- a/src/Serializer/BlogArticleNormalizer.php +++ b/src/Serializer/BlogArticleNormalizer.php @@ -3,7 +3,7 @@ namespace eLife\ApiSdk\Serializer; use DateTimeImmutable; -use eLife\ApiClient\ApiClient\BlogClient; +use eLife\ApiSdk\ApiClient\BlogClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\ApiSdk; diff --git a/src/Serializer/CollectionNormalizer.php b/src/Serializer/CollectionNormalizer.php index 56fd33d7..a9db134c 100644 --- a/src/Serializer/CollectionNormalizer.php +++ b/src/Serializer/CollectionNormalizer.php @@ -3,7 +3,7 @@ namespace eLife\ApiSdk\Serializer; use DateTimeImmutable; -use eLife\ApiClient\ApiClient\CollectionsClient; +use eLife\ApiSdk\ApiClient\CollectionsClient; use eLife\ApiClient\MediaType; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Client\Collections; diff --git a/src/Serializer/DigestNormalizer.php b/src/Serializer/DigestNormalizer.php index 77223f78..ce1f093c 100644 --- a/src/Serializer/DigestNormalizer.php +++ b/src/Serializer/DigestNormalizer.php @@ -4,7 +4,7 @@ use function array_merge; use DateTimeImmutable; -use eLife\ApiClient\ApiClient\DigestsClient; +use eLife\ApiSdk\ApiClient\DigestsClient; use eLife\ApiClient\MediaType; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Client\Digests; diff --git a/src/Serializer/EventNormalizer.php b/src/Serializer/EventNormalizer.php index d1caf686..62fe9b36 100644 --- a/src/Serializer/EventNormalizer.php +++ b/src/Serializer/EventNormalizer.php @@ -4,7 +4,7 @@ use DateTimeImmutable; use DateTimeZone; -use eLife\ApiClient\ApiClient\EventsClient; +use eLife\ApiSdk\ApiClient\EventsClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\ApiSdk; diff --git a/src/Serializer/InterviewNormalizer.php b/src/Serializer/InterviewNormalizer.php index 0cb50d65..ff32dc92 100644 --- a/src/Serializer/InterviewNormalizer.php +++ b/src/Serializer/InterviewNormalizer.php @@ -3,7 +3,7 @@ namespace eLife\ApiSdk\Serializer; use DateTimeImmutable; -use eLife\ApiClient\ApiClient\InterviewsClient; +use eLife\ApiSdk\ApiClient\InterviewsClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\ApiSdk; diff --git a/src/Serializer/JobAdvertNormalizer.php b/src/Serializer/JobAdvertNormalizer.php index 5be5d7b3..15f5972a 100644 --- a/src/Serializer/JobAdvertNormalizer.php +++ b/src/Serializer/JobAdvertNormalizer.php @@ -3,7 +3,7 @@ namespace eLife\ApiSdk\Serializer; use DateTimeImmutable; -use eLife\ApiClient\ApiClient\JobAdvertsClient; +use eLife\ApiSdk\ApiClient\JobAdvertsClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\ApiSdk; diff --git a/src/Serializer/LabsPostNormalizer.php b/src/Serializer/LabsPostNormalizer.php index 61294ad0..d8066aaf 100644 --- a/src/Serializer/LabsPostNormalizer.php +++ b/src/Serializer/LabsPostNormalizer.php @@ -3,7 +3,7 @@ namespace eLife\ApiSdk\Serializer; use DateTimeImmutable; -use eLife\ApiClient\ApiClient\LabsClient; +use eLife\ApiSdk\ApiClient\LabsClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\ApiSdk; diff --git a/src/Serializer/PersonNormalizer.php b/src/Serializer/PersonNormalizer.php index 7ad8b6f1..1ce4d9df 100644 --- a/src/Serializer/PersonNormalizer.php +++ b/src/Serializer/PersonNormalizer.php @@ -2,7 +2,7 @@ namespace eLife\ApiSdk\Serializer; -use eLife\ApiClient\ApiClient\PeopleClient; +use eLife\ApiSdk\ApiClient\PeopleClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\Client\People; diff --git a/src/Serializer/PodcastEpisodeNormalizer.php b/src/Serializer/PodcastEpisodeNormalizer.php index 75a74702..ac95782b 100644 --- a/src/Serializer/PodcastEpisodeNormalizer.php +++ b/src/Serializer/PodcastEpisodeNormalizer.php @@ -3,7 +3,7 @@ namespace eLife\ApiSdk\Serializer; use DateTimeImmutable; -use eLife\ApiClient\ApiClient\PodcastClient; +use eLife\ApiSdk\ApiClient\PodcastClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\ApiSdk; diff --git a/src/Serializer/PressPackageNormalizer.php b/src/Serializer/PressPackageNormalizer.php index 56672292..2a438a3b 100644 --- a/src/Serializer/PressPackageNormalizer.php +++ b/src/Serializer/PressPackageNormalizer.php @@ -3,7 +3,7 @@ namespace eLife\ApiSdk\Serializer; use DateTimeImmutable; -use eLife\ApiClient\ApiClient\PressPackagesClient; +use eLife\ApiSdk\ApiClient\PressPackagesClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\ApiSdk; diff --git a/src/Serializer/ProfileNormalizer.php b/src/Serializer/ProfileNormalizer.php index 4ccde15f..d83e37b5 100644 --- a/src/Serializer/ProfileNormalizer.php +++ b/src/Serializer/ProfileNormalizer.php @@ -2,7 +2,7 @@ namespace eLife\ApiSdk\Serializer; -use eLife\ApiClient\ApiClient\ProfilesClient; +use eLife\ApiSdk\ApiClient\ProfilesClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\Client\Profiles; diff --git a/src/Serializer/PromotionalCollectionNormalizer.php b/src/Serializer/PromotionalCollectionNormalizer.php index f6ccf374..14491913 100644 --- a/src/Serializer/PromotionalCollectionNormalizer.php +++ b/src/Serializer/PromotionalCollectionNormalizer.php @@ -3,7 +3,7 @@ namespace eLife\ApiSdk\Serializer; use DateTimeImmutable; -use eLife\ApiClient\ApiClient\PromotionalCollectionsClient; +use eLife\ApiSdk\ApiClient\PromotionalCollectionsClient; use eLife\ApiClient\MediaType; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Client\PromotionalCollections; diff --git a/src/Serializer/ReviewedPreprintNormalizer.php b/src/Serializer/ReviewedPreprintNormalizer.php index cad5f425..0b8b8f89 100644 --- a/src/Serializer/ReviewedPreprintNormalizer.php +++ b/src/Serializer/ReviewedPreprintNormalizer.php @@ -2,7 +2,7 @@ namespace eLife\ApiSdk\Serializer; -use eLife\ApiClient\ApiClient\ReviewedPreprintsClient; +use eLife\ApiSdk\ApiClient\ReviewedPreprintsClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\ApiSdk; diff --git a/src/Serializer/SubjectNormalizer.php b/src/Serializer/SubjectNormalizer.php index 016a6a44..6ac7a2b2 100644 --- a/src/Serializer/SubjectNormalizer.php +++ b/src/Serializer/SubjectNormalizer.php @@ -2,7 +2,7 @@ namespace eLife\ApiSdk\Serializer; -use eLife\ApiClient\ApiClient\SubjectsClient; +use eLife\ApiSdk\ApiClient\SubjectsClient; use eLife\ApiClient\MediaType; use eLife\ApiClient\Result; use eLife\ApiSdk\Client\Subjects; diff --git a/test/ApiTestCase.php b/test/ApiTestCase.php index 81a865df..f2c8c04f 100644 --- a/test/ApiTestCase.php +++ b/test/ApiTestCase.php @@ -5,30 +5,30 @@ use ComposerLocator; use Csa\GuzzleHttp\Middleware\Cache\MockMiddleware; use DateTimeImmutable; -use eLife\ApiClient\ApiClient\AnnotationsClient; -use eLife\ApiClient\ApiClient\AnnualReportsClient; -use eLife\ApiClient\ApiClient\ArticlesClient; -use eLife\ApiClient\ApiClient\BioprotocolClient; -use eLife\ApiClient\ApiClient\BlogClient; -use eLife\ApiClient\ApiClient\CollectionsClient; -use eLife\ApiClient\ApiClient\CommunityClient; -use eLife\ApiClient\ApiClient\CoversClient; -use eLife\ApiClient\ApiClient\DigestsClient; -use eLife\ApiClient\ApiClient\EventsClient; -use eLife\ApiClient\ApiClient\HighlightsClient; -use eLife\ApiClient\ApiClient\InterviewsClient; -use eLife\ApiClient\ApiClient\JobAdvertsClient; -use eLife\ApiClient\ApiClient\LabsClient; -use eLife\ApiClient\ApiClient\MetricsClient; -use eLife\ApiClient\ApiClient\PeopleClient; -use eLife\ApiClient\ApiClient\PodcastClient; -use eLife\ApiClient\ApiClient\PressPackagesClient; -use eLife\ApiClient\ApiClient\ProfilesClient; -use eLife\ApiClient\ApiClient\PromotionalCollectionsClient; -use eLife\ApiClient\ApiClient\RecommendationsClient; -use eLife\ApiClient\ApiClient\ReviewedPreprintsClient; -use eLife\ApiClient\ApiClient\SearchClient; -use eLife\ApiClient\ApiClient\SubjectsClient; +use eLife\ApiSdk\ApiClient\AnnotationsClient; +use eLife\ApiSdk\ApiClient\AnnualReportsClient; +use eLife\ApiSdk\ApiClient\ArticlesClient; +use eLife\ApiSdk\ApiClient\BioprotocolClient; +use eLife\ApiSdk\ApiClient\BlogClient; +use eLife\ApiSdk\ApiClient\CollectionsClient; +use eLife\ApiSdk\ApiClient\CommunityClient; +use eLife\ApiSdk\ApiClient\CoversClient; +use eLife\ApiSdk\ApiClient\DigestsClient; +use eLife\ApiSdk\ApiClient\EventsClient; +use eLife\ApiSdk\ApiClient\HighlightsClient; +use eLife\ApiSdk\ApiClient\InterviewsClient; +use eLife\ApiSdk\ApiClient\JobAdvertsClient; +use eLife\ApiSdk\ApiClient\LabsClient; +use eLife\ApiSdk\ApiClient\MetricsClient; +use eLife\ApiSdk\ApiClient\PeopleClient; +use eLife\ApiSdk\ApiClient\PodcastClient; +use eLife\ApiSdk\ApiClient\PressPackagesClient; +use eLife\ApiSdk\ApiClient\ProfilesClient; +use eLife\ApiSdk\ApiClient\PromotionalCollectionsClient; +use eLife\ApiSdk\ApiClient\RecommendationsClient; +use eLife\ApiSdk\ApiClient\ReviewedPreprintsClient; +use eLife\ApiSdk\ApiClient\SearchClient; +use eLife\ApiSdk\ApiClient\SubjectsClient; use eLife\ApiClient\HttpClient; use eLife\ApiClient\HttpClient\Guzzle6HttpClient; use eLife\ApiClient\MediaType; diff --git a/test/Client/AnnotationsTest.php b/test/Client/AnnotationsTest.php index f9b49b19..266d89ea 100644 --- a/test/Client/AnnotationsTest.php +++ b/test/Client/AnnotationsTest.php @@ -3,7 +3,7 @@ namespace test\eLife\ApiSdk\Client; use BadMethodCallException; -use eLife\ApiClient\ApiClient\AnnotationsClient; +use eLife\ApiSdk\ApiClient\AnnotationsClient; use eLife\ApiClient\MediaType; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Client\Annotations; diff --git a/test/Client/AnnualReportsTest.php b/test/Client/AnnualReportsTest.php index 2b0afe21..c964365c 100644 --- a/test/Client/AnnualReportsTest.php +++ b/test/Client/AnnualReportsTest.php @@ -3,7 +3,7 @@ namespace test\eLife\ApiSdk\Client; use BadMethodCallException; -use eLife\ApiClient\ApiClient\AnnualReportsClient; +use eLife\ApiSdk\ApiClient\AnnualReportsClient; use eLife\ApiClient\MediaType; use eLife\ApiSdk\Client\AnnualReports; use eLife\ApiSdk\Collection\Sequence; diff --git a/test/Client/ArticlesTest.php b/test/Client/ArticlesTest.php index 5fe8b318..d6d57516 100644 --- a/test/Client/ArticlesTest.php +++ b/test/Client/ArticlesTest.php @@ -3,7 +3,7 @@ namespace test\eLife\ApiSdk\Client; use BadMethodCallException; -use eLife\ApiClient\ApiClient\ArticlesClient; +use eLife\ApiSdk\ApiClient\ArticlesClient; use eLife\ApiClient\MediaType; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Client\Articles; diff --git a/test/Client/BlogArticlesTest.php b/test/Client/BlogArticlesTest.php index d1b1fc3e..151a022a 100644 --- a/test/Client/BlogArticlesTest.php +++ b/test/Client/BlogArticlesTest.php @@ -3,7 +3,7 @@ namespace test\eLife\ApiSdk\Client; use BadMethodCallException; -use eLife\ApiClient\ApiClient\BlogClient; +use eLife\ApiSdk\ApiClient\BlogClient; use eLife\ApiClient\MediaType; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Client\BlogArticles; diff --git a/test/Client/CollectionsTest.php b/test/Client/CollectionsTest.php index 2587d93f..badcd5fa 100644 --- a/test/Client/CollectionsTest.php +++ b/test/Client/CollectionsTest.php @@ -3,7 +3,7 @@ namespace test\eLife\ApiSdk\Client; use BadMethodCallException; -use eLife\ApiClient\ApiClient\CollectionsClient; +use eLife\ApiSdk\ApiClient\CollectionsClient; use eLife\ApiClient\MediaType; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Client\Collections; diff --git a/test/Client/CommunityTest.php b/test/Client/CommunityTest.php index 7408c0ea..b9ae8d45 100644 --- a/test/Client/CommunityTest.php +++ b/test/Client/CommunityTest.php @@ -3,7 +3,7 @@ namespace test\eLife\ApiSdk\Client; use BadMethodCallException; -use eLife\ApiClient\ApiClient\CommunityClient; +use eLife\ApiSdk\ApiClient\CommunityClient; use eLife\ApiClient\MediaType; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Client\Community; diff --git a/test/Client/CoversTest.php b/test/Client/CoversTest.php index 4b192438..0619415a 100644 --- a/test/Client/CoversTest.php +++ b/test/Client/CoversTest.php @@ -4,7 +4,7 @@ use BadMethodCallException; use DateTimeImmutable; -use eLife\ApiClient\ApiClient\CoversClient; +use eLife\ApiSdk\ApiClient\CoversClient; use eLife\ApiClient\MediaType; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Client\Covers; diff --git a/test/Client/DigestsTest.php b/test/Client/DigestsTest.php index b368301a..2f4e6d43 100644 --- a/test/Client/DigestsTest.php +++ b/test/Client/DigestsTest.php @@ -3,7 +3,7 @@ namespace test\eLife\ApiSdk\Client; use BadMethodCallException; -use eLife\ApiClient\ApiClient\DigestsClient; +use eLife\ApiSdk\ApiClient\DigestsClient; use eLife\ApiClient\MediaType; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Client\Digests; diff --git a/test/Client/EventsTest.php b/test/Client/EventsTest.php index 8023d81a..6390a143 100644 --- a/test/Client/EventsTest.php +++ b/test/Client/EventsTest.php @@ -3,7 +3,7 @@ namespace test\eLife\ApiSdk\Client; use BadMethodCallException; -use eLife\ApiClient\ApiClient\EventsClient; +use eLife\ApiSdk\ApiClient\EventsClient; use eLife\ApiClient\MediaType; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Client\Events; diff --git a/test/Client/HighlightsTest.php b/test/Client/HighlightsTest.php index 14ba0f89..4a4b57e1 100644 --- a/test/Client/HighlightsTest.php +++ b/test/Client/HighlightsTest.php @@ -3,7 +3,7 @@ namespace test\eLife\ApiSdk\Client; use BadMethodCallException; -use eLife\ApiClient\ApiClient\HighlightsClient; +use eLife\ApiSdk\ApiClient\HighlightsClient; use eLife\ApiClient\MediaType; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Client\Highlights; diff --git a/test/Client/InterviewsTest.php b/test/Client/InterviewsTest.php index 356d5db7..f44bae51 100644 --- a/test/Client/InterviewsTest.php +++ b/test/Client/InterviewsTest.php @@ -3,7 +3,7 @@ namespace test\eLife\ApiSdk\Client; use BadMethodCallException; -use eLife\ApiClient\ApiClient\InterviewsClient; +use eLife\ApiSdk\ApiClient\InterviewsClient; use eLife\ApiClient\MediaType; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Client\Interviews; diff --git a/test/Client/JobAdvertsTest.php b/test/Client/JobAdvertsTest.php index e2b95ce2..40f37bdd 100644 --- a/test/Client/JobAdvertsTest.php +++ b/test/Client/JobAdvertsTest.php @@ -3,7 +3,7 @@ namespace test\eLife\ApiSdk\Client; use BadMethodCallException; -use eLife\ApiClient\ApiClient\JobAdvertsClient; +use eLife\ApiSdk\ApiClient\JobAdvertsClient; use eLife\ApiClient\MediaType; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Client\JobAdverts; diff --git a/test/Client/LabsPostsTest.php b/test/Client/LabsPostsTest.php index e55a6d3f..6846d1d7 100644 --- a/test/Client/LabsPostsTest.php +++ b/test/Client/LabsPostsTest.php @@ -3,7 +3,7 @@ namespace test\eLife\ApiSdk\Client; use BadMethodCallException; -use eLife\ApiClient\ApiClient\LabsClient; +use eLife\ApiSdk\ApiClient\LabsClient; use eLife\ApiClient\MediaType; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Client\LabsPosts; diff --git a/test/Client/MetricsTest.php b/test/Client/MetricsTest.php index 66abc76f..374327a9 100644 --- a/test/Client/MetricsTest.php +++ b/test/Client/MetricsTest.php @@ -2,7 +2,7 @@ namespace test\eLife\ApiSdk\Client; -use eLife\ApiClient\ApiClient\MetricsClient; +use eLife\ApiSdk\ApiClient\MetricsClient; use eLife\ApiSdk\Client\Metrics; use eLife\ApiSdk\Model\CitationsMetric; use eLife\ApiSdk\Model\CitationsMetricSource; diff --git a/test/Client/PeopleTest.php b/test/Client/PeopleTest.php index 45abc9f8..d139038e 100644 --- a/test/Client/PeopleTest.php +++ b/test/Client/PeopleTest.php @@ -3,7 +3,7 @@ namespace test\eLife\ApiSdk\Client; use BadMethodCallException; -use eLife\ApiClient\ApiClient\PeopleClient; +use eLife\ApiSdk\ApiClient\PeopleClient; use eLife\ApiClient\MediaType; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Client\People; diff --git a/test/Client/PodcastEpisodesTest.php b/test/Client/PodcastEpisodesTest.php index d7ae49ef..42746d07 100644 --- a/test/Client/PodcastEpisodesTest.php +++ b/test/Client/PodcastEpisodesTest.php @@ -3,7 +3,7 @@ namespace test\eLife\ApiSdk\Client; use BadMethodCallException; -use eLife\ApiClient\ApiClient\PodcastClient; +use eLife\ApiSdk\ApiClient\PodcastClient; use eLife\ApiClient\MediaType; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Client\PodcastEpisodes; diff --git a/test/Client/PressPackagesTest.php b/test/Client/PressPackagesTest.php index 281a3376..7e53460c 100644 --- a/test/Client/PressPackagesTest.php +++ b/test/Client/PressPackagesTest.php @@ -3,7 +3,7 @@ namespace test\eLife\ApiSdk\Client; use BadMethodCallException; -use eLife\ApiClient\ApiClient\PressPackagesClient; +use eLife\ApiSdk\ApiClient\PressPackagesClient; use eLife\ApiClient\MediaType; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Client\PressPackages; diff --git a/test/Client/ProfilesTest.php b/test/Client/ProfilesTest.php index d49d56d2..5190ded3 100644 --- a/test/Client/ProfilesTest.php +++ b/test/Client/ProfilesTest.php @@ -3,7 +3,7 @@ namespace test\eLife\ApiSdk\Client; use BadMethodCallException; -use eLife\ApiClient\ApiClient\ProfilesClient; +use eLife\ApiSdk\ApiClient\ProfilesClient; use eLife\ApiClient\MediaType; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Client\Profiles; diff --git a/test/Client/PromotionalCollectionsTest.php b/test/Client/PromotionalCollectionsTest.php index 67836c84..f6f4e8d1 100644 --- a/test/Client/PromotionalCollectionsTest.php +++ b/test/Client/PromotionalCollectionsTest.php @@ -3,7 +3,7 @@ namespace test\eLife\ApiSdk\Client; use BadMethodCallException; -use eLife\ApiClient\ApiClient\PromotionalCollectionsClient; +use eLife\ApiSdk\ApiClient\PromotionalCollectionsClient; use eLife\ApiClient\MediaType; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Client\PromotionalCollections; diff --git a/test/Client/RecommendationsTest.php b/test/Client/RecommendationsTest.php index dc2802e6..eed1d6ce 100644 --- a/test/Client/RecommendationsTest.php +++ b/test/Client/RecommendationsTest.php @@ -3,7 +3,7 @@ namespace test\eLife\ApiSdk\Client; use BadMethodCallException; -use eLife\ApiClient\ApiClient\RecommendationsClient; +use eLife\ApiSdk\ApiClient\RecommendationsClient; use eLife\ApiClient\MediaType; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Client\Recommendations; diff --git a/test/Client/ReviewedPreprintsTest.php b/test/Client/ReviewedPreprintsTest.php index e831e842..60d09eb4 100644 --- a/test/Client/ReviewedPreprintsTest.php +++ b/test/Client/ReviewedPreprintsTest.php @@ -4,7 +4,7 @@ use BadMethodCallException; use DateTimeImmutable; -use eLife\ApiClient\ApiClient\ReviewedPreprintsClient; +use eLife\ApiSdk\ApiClient\ReviewedPreprintsClient; use eLife\ApiClient\MediaType; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Client\ReviewedPreprints; diff --git a/test/Client/SearchTest.php b/test/Client/SearchTest.php index f9be3cd6..07a50dd5 100644 --- a/test/Client/SearchTest.php +++ b/test/Client/SearchTest.php @@ -4,7 +4,7 @@ use BadMethodCallException; use DateTimeImmutable; -use eLife\ApiClient\ApiClient\SearchClient; +use eLife\ApiSdk\ApiClient\SearchClient; use eLife\ApiClient\MediaType; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Client\Search; diff --git a/test/Client/SubjectsTest.php b/test/Client/SubjectsTest.php index 41ccf772..53178edc 100644 --- a/test/Client/SubjectsTest.php +++ b/test/Client/SubjectsTest.php @@ -3,7 +3,7 @@ namespace test\eLife\ApiSdk\Client; use BadMethodCallException; -use eLife\ApiClient\ApiClient\SubjectsClient; +use eLife\ApiSdk\ApiClient\SubjectsClient; use eLife\ApiClient\MediaType; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Client\Subjects; diff --git a/test/Serializer/ArticlePoANormalizerTest.php b/test/Serializer/ArticlePoANormalizerTest.php index 40d6a5de..95a3a8ea 100644 --- a/test/Serializer/ArticlePoANormalizerTest.php +++ b/test/Serializer/ArticlePoANormalizerTest.php @@ -2,7 +2,7 @@ namespace test\eLife\ApiSdk\Serializer; -use eLife\ApiClient\ApiClient\ArticlesClient; +use eLife\ApiSdk\ApiClient\ArticlesClient; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Collection\ArraySequence; use eLife\ApiSdk\Model\Article; diff --git a/test/Serializer/ArticleVoRNormalizerTest.php b/test/Serializer/ArticleVoRNormalizerTest.php index 33dfb732..c48291ec 100644 --- a/test/Serializer/ArticleVoRNormalizerTest.php +++ b/test/Serializer/ArticleVoRNormalizerTest.php @@ -3,7 +3,7 @@ namespace test\eLife\ApiSdk\Serializer; use DateTimeImmutable; -use eLife\ApiClient\ApiClient\ArticlesClient; +use eLife\ApiSdk\ApiClient\ArticlesClient; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Collection\ArraySequence; use eLife\ApiSdk\Collection\EmptySequence; diff --git a/test/Serializer/BlogArticleNormalizerTest.php b/test/Serializer/BlogArticleNormalizerTest.php index 34b61915..811e7de6 100644 --- a/test/Serializer/BlogArticleNormalizerTest.php +++ b/test/Serializer/BlogArticleNormalizerTest.php @@ -4,7 +4,7 @@ use DateTimeImmutable; use DateTimeZone; -use eLife\ApiClient\ApiClient\BlogClient; +use eLife\ApiSdk\ApiClient\BlogClient; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Collection\ArraySequence; use eLife\ApiSdk\Collection\EmptySequence; diff --git a/test/Serializer/CollectionNormalizerTest.php b/test/Serializer/CollectionNormalizerTest.php index af295532..1be418c5 100644 --- a/test/Serializer/CollectionNormalizerTest.php +++ b/test/Serializer/CollectionNormalizerTest.php @@ -3,7 +3,7 @@ namespace test\eLife\ApiSdk\Serializer; use DateTimeImmutable; -use eLife\ApiClient\ApiClient\CollectionsClient; +use eLife\ApiSdk\ApiClient\CollectionsClient; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Collection\ArraySequence; use eLife\ApiSdk\Collection\EmptySequence; diff --git a/test/Serializer/DigestNormalizerTest.php b/test/Serializer/DigestNormalizerTest.php index c0865d25..45cc7389 100644 --- a/test/Serializer/DigestNormalizerTest.php +++ b/test/Serializer/DigestNormalizerTest.php @@ -5,7 +5,7 @@ use function call_user_func; use DateTimeImmutable; use DateTimeZone; -use eLife\ApiClient\ApiClient\DigestsClient; +use eLife\ApiSdk\ApiClient\DigestsClient; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Collection\EmptySequence; use eLife\ApiSdk\Model\ArticleVoR; diff --git a/test/Serializer/EventNormalizerTest.php b/test/Serializer/EventNormalizerTest.php index f4857772..2f8173d0 100644 --- a/test/Serializer/EventNormalizerTest.php +++ b/test/Serializer/EventNormalizerTest.php @@ -4,7 +4,7 @@ use DateTimeImmutable; use DateTimeZone; -use eLife\ApiClient\ApiClient\EventsClient; +use eLife\ApiSdk\ApiClient\EventsClient; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Collection\ArraySequence; use eLife\ApiSdk\Collection\EmptySequence; diff --git a/test/Serializer/InterviewNormalizerTest.php b/test/Serializer/InterviewNormalizerTest.php index 29475150..5ba007d6 100644 --- a/test/Serializer/InterviewNormalizerTest.php +++ b/test/Serializer/InterviewNormalizerTest.php @@ -4,7 +4,7 @@ use DateTimeImmutable; use DateTimeZone; -use eLife\ApiClient\ApiClient\InterviewsClient; +use eLife\ApiSdk\ApiClient\InterviewsClient; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Collection\ArraySequence; use eLife\ApiSdk\Collection\EmptySequence; diff --git a/test/Serializer/JobsAdvertNormalizerTest.php b/test/Serializer/JobsAdvertNormalizerTest.php index 4c824a9e..1a94c5c9 100644 --- a/test/Serializer/JobsAdvertNormalizerTest.php +++ b/test/Serializer/JobsAdvertNormalizerTest.php @@ -4,7 +4,7 @@ use DateTimeImmutable; use DateTimeZone; -use eLife\ApiClient\ApiClient\JobAdvertsClient; +use eLife\ApiSdk\ApiClient\JobAdvertsClient; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Collection\ArraySequence; use eLife\ApiSdk\Collection\PromiseSequence; diff --git a/test/Serializer/LabsPostNormalizerTest.php b/test/Serializer/LabsPostNormalizerTest.php index f99c6e56..d7060ca2 100644 --- a/test/Serializer/LabsPostNormalizerTest.php +++ b/test/Serializer/LabsPostNormalizerTest.php @@ -4,7 +4,7 @@ use DateTimeImmutable; use DateTimeZone; -use eLife\ApiClient\ApiClient\LabsClient; +use eLife\ApiSdk\ApiClient\LabsClient; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Collection\ArraySequence; use eLife\ApiSdk\Collection\PromiseSequence; diff --git a/test/Serializer/PersonNormalizerTest.php b/test/Serializer/PersonNormalizerTest.php index 9f46f80f..1836bc38 100644 --- a/test/Serializer/PersonNormalizerTest.php +++ b/test/Serializer/PersonNormalizerTest.php @@ -2,7 +2,7 @@ namespace test\eLife\ApiSdk\Serializer; -use eLife\ApiClient\ApiClient\PeopleClient; +use eLife\ApiSdk\ApiClient\PeopleClient; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Collection\ArraySequence; use eLife\ApiSdk\Collection\EmptySequence; diff --git a/test/Serializer/PodcastEpisodeNormalizerTest.php b/test/Serializer/PodcastEpisodeNormalizerTest.php index 02fd5486..79161c99 100644 --- a/test/Serializer/PodcastEpisodeNormalizerTest.php +++ b/test/Serializer/PodcastEpisodeNormalizerTest.php @@ -4,7 +4,7 @@ use DateTimeImmutable; use DateTimeZone; -use eLife\ApiClient\ApiClient\PodcastClient; +use eLife\ApiSdk\ApiClient\PodcastClient; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Collection\ArraySequence; use eLife\ApiSdk\Collection\EmptySequence; diff --git a/test/Serializer/PressPackageNormalizerTest.php b/test/Serializer/PressPackageNormalizerTest.php index 351f0d71..9ac74735 100644 --- a/test/Serializer/PressPackageNormalizerTest.php +++ b/test/Serializer/PressPackageNormalizerTest.php @@ -4,7 +4,7 @@ use DateTimeImmutable; use DateTimeZone; -use eLife\ApiClient\ApiClient\PressPackagesClient; +use eLife\ApiSdk\ApiClient\PressPackagesClient; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Model\ArticlePoA; use eLife\ApiSdk\Model\Block\Paragraph; diff --git a/test/Serializer/ProfileNormalizerTest.php b/test/Serializer/ProfileNormalizerTest.php index 24deb860..26f596c4 100644 --- a/test/Serializer/ProfileNormalizerTest.php +++ b/test/Serializer/ProfileNormalizerTest.php @@ -2,7 +2,7 @@ namespace test\eLife\ApiSdk\Serializer; -use eLife\ApiClient\ApiClient\ProfilesClient; +use eLife\ApiSdk\ApiClient\ProfilesClient; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Collection\ArraySequence; use eLife\ApiSdk\Collection\EmptySequence; diff --git a/test/Serializer/PromotionalCollectionNormalizerTest.php b/test/Serializer/PromotionalCollectionNormalizerTest.php index d10e7333..ffb7f21b 100644 --- a/test/Serializer/PromotionalCollectionNormalizerTest.php +++ b/test/Serializer/PromotionalCollectionNormalizerTest.php @@ -3,7 +3,7 @@ namespace test\eLife\ApiSdk\Serializer; use DateTimeImmutable; -use eLife\ApiClient\ApiClient\PromotionalCollectionsClient; +use eLife\ApiSdk\ApiClient\PromotionalCollectionsClient; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Collection\ArraySequence; use eLife\ApiSdk\Collection\EmptySequence; diff --git a/test/Serializer/ReviewedPreprintNormalizerTest.php b/test/Serializer/ReviewedPreprintNormalizerTest.php index 33a094bd..3570fcfa 100644 --- a/test/Serializer/ReviewedPreprintNormalizerTest.php +++ b/test/Serializer/ReviewedPreprintNormalizerTest.php @@ -2,7 +2,7 @@ namespace test\eLife\ApiSdk\Serializer; -use eLife\ApiClient\ApiClient\ReviewedPreprintsClient; +use eLife\ApiSdk\ApiClient\ReviewedPreprintsClient; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Collection\ArraySequence; use eLife\ApiSdk\Model\ReviewedPreprint; diff --git a/test/Serializer/SubjectNormalizerTest.php b/test/Serializer/SubjectNormalizerTest.php index 9eadf6fc..b272b505 100644 --- a/test/Serializer/SubjectNormalizerTest.php +++ b/test/Serializer/SubjectNormalizerTest.php @@ -2,7 +2,7 @@ namespace test\eLife\ApiSdk\Serializer; -use eLife\ApiClient\ApiClient\SubjectsClient; +use eLife\ApiSdk\ApiClient\SubjectsClient; use eLife\ApiSdk\ApiSdk; use eLife\ApiSdk\Collection\ArraySequence; use eLife\ApiSdk\Collection\EmptySequence;