Skip to content

Commit 35b88ee

Browse files
committed
[Http] Add Http adapter functions
1 parent dd77477 commit 35b88ee

6 files changed

Lines changed: 47 additions & 3 deletions

File tree

bin/docs.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,14 @@ public function execute(InputInterface $input, OutputInterface $output) : int
3737

3838
$paths = [
3939
__DIR__ . '/../src/core/etl/src/Flow/ETL/DSL/functions.php',
40+
__DIR__ . '/../src/adapter/etl-adapter-avro/src/Flow/ETL/Adapter/Avro/functions.php',
4041
__DIR__ . '/../src/adapter/etl-adapter-chartjs/src/Flow/ETL/Adapter/ChartJS/functions.php',
4142
__DIR__ . '/../src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/functions.php',
4243
__DIR__ . '/../src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/functions.php',
44+
__DIR__ . '/../src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/DSL/functions.php',
4345
__DIR__ . '/../src/adapter/etl-adapter-elasticsearch/src/Flow/ETL/Adapter/Elasticsearch/functions.php',
4446
__DIR__ . '/../src/adapter/etl-adapter-google-sheet/src/Flow/ETL/Adapter/GoogleSheet/functions.php',
47+
__DIR__ . '/../src/adapter/etl-adapter-http/src/Flow/ETL/Adapter/Http/DSL/functions.php',
4548
__DIR__ . '/../src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/functions.php',
4649
__DIR__ . '/../src/adapter/etl-adapter-meilisearch/src/Flow/ETL/Adapter/Meilisearch/functions.php',
4750
__DIR__ . '/../src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/functions.php',

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@
146146
"src/adapter/etl-adapter-elasticsearch/src/Flow/ETL/Adapter/Elasticsearch/functions.php",
147147
"src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/DSL/functions.php",
148148
"src/adapter/etl-adapter-google-sheet/src/Flow/ETL/Adapter/GoogleSheet/functions.php",
149+
"src/adapter/etl-adapter-http/src/Flow/ETL/Adapter/Http/DSL/functions.php",
149150
"src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/functions.php",
150151
"src/adapter/etl-adapter-meilisearch/src/Flow/ETL/Adapter/Meilisearch/functions.php",
151152
"src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/functions.php",

src/adapter/etl-adapter-http/composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@
2929
"Flow\\": [
3030
"src/Flow"
3131
]
32-
}
32+
},
33+
"files": [
34+
"src/Flow/ETL/Adapter/Http/DSL/functions.php"
35+
]
3336
},
3437
"autoload-dev": {
3538
"psr-4": {
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Flow\ETL\Adapter\Http;
6+
7+
use Flow\ETL\{Adapter\Http\DynamicExtractor\NextRequestFactory,
8+
Attribute\DocumentationDSL,
9+
Attribute\Module,
10+
Attribute\Type};
11+
use Psr\Http\Client\ClientInterface;
12+
use Psr\Http\Message\RequestInterface;
13+
14+
#[DocumentationDSL(module: Module::HTTP, type: Type::EXTRACTOR)]
15+
function from_dynamic_http_client(
16+
ClientInterface $client,
17+
NextRequestFactory $requestFactory,
18+
) : PsrHttpClientDynamicExtractor {
19+
return new PsrHttpClientDynamicExtractor(
20+
$client,
21+
$requestFactory,
22+
);
23+
}
24+
25+
/**
26+
* @param iterable<RequestInterface> $requests
27+
*/
28+
#[DocumentationDSL(module: Module::HTTP, type: Type::EXTRACTOR)]
29+
function from_static_http_client(
30+
ClientInterface $client,
31+
iterable $requests,
32+
) : PsrHttpClientStaticExtractor {
33+
return new PsrHttpClientStaticExtractor(
34+
$client,
35+
$requests,
36+
);
37+
}

src/core/etl/src/Flow/ETL/Attribute/Module.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ enum Module : string
1111
case CHART_JS = 'CHART_JS';
1212
case CORE = 'CORE';
1313
case CSV = 'CSV';
14-
1514
case DEPRECATED = 'DEPRECATED';
1615
case DOCTRINE = 'DOCTRINE';
1716
case ELASTIC_SEARCH = 'ELASTIC_SEARCH';
1817
case EXCEL = 'EXCEL';
1918
case FILESYSTEM = 'FILESYSTEM';
2019
case GOOGLE_SHEET = 'GOOGLE_SHEET';
20+
case HTTP = 'HTTP';
2121
case JSON = 'JSON';
2222
case MEILI_SEARCH = 'MEILI_SEARCH';
2323
case PARQUET = 'PARQUET';

web/landing/resources/dsl.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)