File tree Expand file tree Collapse file tree 14 files changed +276
-31
lines changed
Expand file tree Collapse file tree 14 files changed +276
-31
lines changed Original file line number Diff line number Diff line change 22 "name" : " php-etl/magento-v2-flow" ,
33 "autoload" : {
44 "psr-4" : {
5- "Kiboko\\ Magento\\ V2 \\ Extractor\\ " : " src/"
5+ "Kiboko\\ Magento\\ v2_3 \\ Extractor\\ " : " src/v2_3 "
66 }
77 },
88 "autoload-dev" : {
2020 "php" : " ^8.1" ,
2121 "php-etl/pipeline-contracts" : " ^0.3.3" ,
2222 "psr/log" : " ^1.0" ,
23- "php-etl/magento-v2-api-client" : " 0.1.x-dev " ,
23+ "php-etl/magento-v2-api-client" : " ^ 0.1.0 " ,
2424 "nyholm/psr7" : " ^1.5" ,
2525 "php-etl/bucket" : " ^0.2.0" ,
2626 "php-http/guzzle7-adapter" : " ^1.0"
Original file line number Diff line number Diff line change 22
33declare (strict_types=1 );
44
5- namespace Kiboko \Magento \V2 \Extractor ;
5+ namespace Kiboko \Magento \v2_1 \Extractor ;
6+
7+ use Kiboko \Magento \v2_1 \Client ;
68
79final class CustomersExtractor implements \Kiboko \Contract \Pipeline \ExtractorInterface
810{
9- public function __construct (private \Psr \Log \LoggerInterface $ logger , private \ Kiboko \ Magento \ V2 \ Client $ client )
11+ public function __construct (private \Psr \Log \LoggerInterface $ logger , private Client $ client )
1012 {
1113 }
1214
@@ -16,7 +18,7 @@ public function extract(): iterable
1618 $ response = $ this ->client ->customerCustomerRepositoryV1GetListGet (queryParameters: [
1719 'searchCriteria[currentPage] ' => 1 ,
1820 'searchCriteria[pageSize] ' => 100 ,
19- ], fetch: \ Kiboko \ Magento \ V2 \ Client::FETCH_RESPONSE );
21+ ], fetch: Client::FETCH_RESPONSE );
2022
2123 if ($ response instanceof \Psr \Http \Message \ResponseInterface) {
2224 if ($ response ->getStatusCode () !== 200 ) {
Original file line number Diff line number Diff line change 22
33declare (strict_types=1 );
44
5- namespace Kiboko \Magento \V2 \Extractor ;
5+ namespace Kiboko \Magento \v2_1 \Extractor ;
6+
7+ use Kiboko \Magento \v2_1 \Client ;
68
79final class OrdersExtractor implements \Kiboko \Contract \Pipeline \ExtractorInterface
810{
9- public function __construct (private \Psr \Log \LoggerInterface $ logger , private \ Kiboko \ Magento \ V2 \ Client $ client )
11+ public function __construct (private \Psr \Log \LoggerInterface $ logger , private Client $ client )
1012 {
1113 }
1214
@@ -16,7 +18,7 @@ public function extract(): iterable
1618 $ response = $ this ->client ->salesOrderRepositoryV1GetListGet (queryParameters: [
1719 'searchCriteria[currentPage] ' => 1 ,
1820 'searchCriteria[pageSize] ' => 100 ,
19- ], fetch: \ Kiboko \ Magento \ V2 \ Client::FETCH_RESPONSE );
21+ ], fetch: Client::FETCH_RESPONSE );
2022
2123 if ($ response instanceof \Psr \Http \Message \ResponseInterface) {
2224 if ($ response ->getStatusCode () !== 200 ) {
Original file line number Diff line number Diff line change 22
33declare (strict_types=1 );
44
5- namespace Kiboko \Magento \V2 \Extractor ;
5+ namespace Kiboko \Magento \v2_1 \Extractor ;
6+
7+ use Kiboko \Magento \v2_1 \Client ;
68
79final class ProductsExtractor implements \Kiboko \Contract \Pipeline \ExtractorInterface
810{
9- public function __construct (private \Psr \Log \LoggerInterface $ logger , private \ Kiboko \ Magento \ V2 \ Client $ client )
11+ public function __construct (private \Psr \Log \LoggerInterface $ logger , private Client $ client )
1012 {
1113 }
1214
@@ -16,7 +18,7 @@ public function extract(): iterable
1618 $ response = $ this ->client ->catalogProductRepositoryV1GetListGet (queryParameters: [
1719 'searchCriteria[currentPage] ' => 1 ,
1820 'searchCriteria[pageSize] ' => 100 ,
19- ], fetch: \ Kiboko \ Magento \ V2 \ Client::FETCH_RESPONSE );
21+ ], fetch: Client::FETCH_RESPONSE );
2022
2123 if ($ response instanceof \Psr \Http \Message \ResponseInterface) {
2224 if ($ response ->getStatusCode () !== 200 ) {
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Kiboko \Magento \v2_3 \Extractor ;
6+
7+ use Kiboko \Magento \v2_3 \Client ;
8+
9+ final class CustomersExtractor implements \Kiboko \Contract \Pipeline \ExtractorInterface
10+ {
11+ public function __construct (private \Psr \Log \LoggerInterface $ logger , private Client $ client )
12+ {
13+ }
14+
15+ public function extract (): iterable
16+ {
17+ try {
18+ $ response = $ this ->client ->customerCustomerRepositoryV1GetListGet (queryParameters: [
19+ 'searchCriteria[currentPage] ' => 1 ,
20+ 'searchCriteria[pageSize] ' => 100 ,
21+ ], fetch: Client::FETCH_RESPONSE );
22+
23+ if ($ response instanceof \Psr \Http \Message \ResponseInterface) {
24+ if ($ response ->getStatusCode () !== 200 ) {
25+ throw new \RuntimeException ($ response ->getReasonPhrase ());
26+ }
27+
28+ $ results = json_decode ($ response ->getBody ()->getContents (), true )['items ' ];
29+
30+ foreach ($ results as $ item ) {
31+ (yield new \Kiboko \Component \Bucket \AcceptanceResultBucket ($ item ));
32+ }
33+ }
34+ } catch (\Exception $ exception ) {
35+ $ this ->logger ->alert ($ exception ->getMessage (), ['exception ' => $ exception ]);
36+ }
37+ }
38+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Kiboko \Magento \v2_3 \Extractor ;
6+
7+ use Kiboko \Magento \v2_3 \Client ;
8+
9+ final class OrdersExtractor implements \Kiboko \Contract \Pipeline \ExtractorInterface
10+ {
11+ public function __construct (private \Psr \Log \LoggerInterface $ logger , private Client $ client )
12+ {
13+ }
14+
15+ public function extract (): iterable
16+ {
17+ try {
18+ $ response = $ this ->client ->salesOrderRepositoryV1GetListGet (queryParameters: [
19+ 'searchCriteria[currentPage] ' => 1 ,
20+ 'searchCriteria[pageSize] ' => 100 ,
21+ ], fetch: Client::FETCH_RESPONSE );
22+
23+ if ($ response instanceof \Psr \Http \Message \ResponseInterface) {
24+ if ($ response ->getStatusCode () !== 200 ) {
25+ throw new \RuntimeException ($ response ->getReasonPhrase ());
26+ }
27+
28+ $ results = json_decode ($ response ->getBody ()->getContents (), true )['items ' ];
29+
30+ foreach ($ results as $ item ) {
31+ (yield new \Kiboko \Component \Bucket \AcceptanceResultBucket ($ item ));
32+ }
33+ }
34+ } catch (\Exception $ exception ) {
35+ $ this ->logger ->alert ($ exception ->getMessage (), ['exception ' => $ exception ]);
36+ }
37+ }
38+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Kiboko \Magento \v2_3 \Extractor ;
6+
7+ use Kiboko \Magento \v2_3 \Client ;
8+
9+ final class ProductsExtractor implements \Kiboko \Contract \Pipeline \ExtractorInterface
10+ {
11+ public function __construct (private \Psr \Log \LoggerInterface $ logger , private Client $ client )
12+ {
13+ }
14+
15+ public function extract (): iterable
16+ {
17+ try {
18+ $ response = $ this ->client ->catalogProductRepositoryV1GetListGet (queryParameters: [
19+ 'searchCriteria[currentPage] ' => 1 ,
20+ 'searchCriteria[pageSize] ' => 100 ,
21+ ], fetch: Client::FETCH_RESPONSE );
22+
23+ if ($ response instanceof \Psr \Http \Message \ResponseInterface) {
24+ if ($ response ->getStatusCode () !== 200 ) {
25+ throw new \RuntimeException ($ response ->getReasonPhrase ());
26+ }
27+
28+ $ results = json_decode ($ response ->getBody ()->getContents (), true )['items ' ];
29+
30+ foreach ($ results as $ item ) {
31+ (yield new \Kiboko \Component \Bucket \AcceptanceResultBucket ($ item ));
32+ }
33+ }
34+ } catch (\Exception $ exception ) {
35+ $ this ->logger ->alert ($ exception ->getMessage (), ['exception ' => $ exception ]);
36+ }
37+ }
38+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Kiboko \Magento \v2_4 \Extractor ;
6+
7+ use Kiboko \Magento \v2_4 \Client ;
8+
9+ final class CustomersExtractor implements \Kiboko \Contract \Pipeline \ExtractorInterface
10+ {
11+ public function __construct (private \Psr \Log \LoggerInterface $ logger , private Client $ client )
12+ {
13+ }
14+
15+ public function extract (): iterable
16+ {
17+ try {
18+ $ response = $ this ->client ->customerCustomerRepositoryV1GetListGet (queryParameters: [
19+ 'searchCriteria[currentPage] ' => 1 ,
20+ 'searchCriteria[pageSize] ' => 100 ,
21+ ], fetch: Client::FETCH_RESPONSE );
22+
23+ if ($ response instanceof \Psr \Http \Message \ResponseInterface) {
24+ if ($ response ->getStatusCode () !== 200 ) {
25+ throw new \RuntimeException ($ response ->getReasonPhrase ());
26+ }
27+
28+ $ results = json_decode ($ response ->getBody ()->getContents (), true )['items ' ];
29+
30+ foreach ($ results as $ item ) {
31+ (yield new \Kiboko \Component \Bucket \AcceptanceResultBucket ($ item ));
32+ }
33+ }
34+ } catch (\Exception $ exception ) {
35+ $ this ->logger ->alert ($ exception ->getMessage (), ['exception ' => $ exception ]);
36+ }
37+ }
38+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Kiboko \Magento \v2_4 \Extractor ;
6+
7+ use Kiboko \Magento \v2_4 \Client ;
8+
9+ final class OrdersExtractor implements \Kiboko \Contract \Pipeline \ExtractorInterface
10+ {
11+ public function __construct (private \Psr \Log \LoggerInterface $ logger , private Client $ client )
12+ {
13+ }
14+
15+ public function extract (): iterable
16+ {
17+ try {
18+ $ response = $ this ->client ->salesOrderRepositoryV1GetListGet (queryParameters: [
19+ 'searchCriteria[currentPage] ' => 1 ,
20+ 'searchCriteria[pageSize] ' => 100 ,
21+ ], fetch: Client::FETCH_RESPONSE );
22+
23+ if ($ response instanceof \Psr \Http \Message \ResponseInterface) {
24+ if ($ response ->getStatusCode () !== 200 ) {
25+ throw new \RuntimeException ($ response ->getReasonPhrase ());
26+ }
27+
28+ $ results = json_decode ($ response ->getBody ()->getContents (), true )['items ' ];
29+
30+ foreach ($ results as $ item ) {
31+ (yield new \Kiboko \Component \Bucket \AcceptanceResultBucket ($ item ));
32+ }
33+ }
34+ } catch (\Exception $ exception ) {
35+ $ this ->logger ->alert ($ exception ->getMessage (), ['exception ' => $ exception ]);
36+ }
37+ }
38+ }
You can’t perform that action at this time.
0 commit comments