| 14 | use OCA\Analytics\Service\VariableService; |
| 15 | |
| 16 | class ExternalCsv implements IDatasource |
| 17 | { |
| 18 | private const CACHE_TTL_SECONDS = 30; |
| 19 | |
| 20 | private $logger; |
| 21 | private $userId; |
| 22 | private $l10n; |
| 23 | private $VariableService; |
| 24 | private ExternalHttpClient $httpClient; |
| 25 | |
| 26 | public function __construct( |
| 27 | $userId, |
| 28 | IL10N $l10n, |
| 29 | LoggerInterface $logger, |
| 30 | VariableService $VariableService, |
| 31 | ExternalHttpClient $httpClient, |
| 32 | ) |
| 33 | { |
| 34 | $this->userId = $userId; |
| 35 | $this->l10n = $l10n; |
| 36 | $this->logger = $logger; |
| 37 | $this->VariableService = $VariableService; |
| 38 | $this->httpClient = $httpClient; |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * @return string Display Name of the data source |
| 43 | */ |
| 44 | public function getName(): string |
| 45 | { |
| 46 | return $this->l10n->t('External') . ': csv'; |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * @return int digit unique data source id |
| 51 | */ |
| 52 | public function getId(): int |
| 53 | { |
| 54 | return 4; |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * @return array available options of the data source |
| 59 | */ |
| 60 | public function getTemplate(): array |
| 61 | { |
| 62 | $template = array(); |
| 63 | $template[] = ['id' => 'link', 'name' => $this->l10n->t('External URL'), 'placeholder' => 'url']; |
| 64 | $template[] = ['id' => 'hasHeader', 'name' => $this->l10n->t('Header row'), 'placeholder' => 'true-' . $this->l10n->t('Yes').'/false-'.$this->l10n->t('No'), 'type' => 'tf']; |
| 65 | $template[] = ['id' => 'offset', 'name' => $this->l10n->t('Ignore leading rows'), 'placeholder' => $this->l10n->t('Number of rows'), 'type' => 'number']; |
| 66 | $template[] = ['id' => 'columns', 'name' => $this->l10n->t('Select columns'), 'placeholder' => $this->l10n->t('e.g. 1,2,4 or leave empty'), 'type' => 'columnPicker']; |
| 67 | return $template; |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * Read the Data |
| 72 | * @param $option |
| 73 | * @return array available options of the data source |
nothing calls this directly
no outgoing calls
no test coverage detected