Skip to content

Commit 4a99008

Browse files
committed
refactor: move application into connection/ subdirectory
- Move src, config, public, templates, legacy-app, tests into connection/ - Rename kebab-case packages to PascalCase (StorageApiPhpClient, ManageApiPhpClient, StorageDriverPostgres, StorageDriverSupabase) - Move Package/Monorepo to tools/monorepo This commit contains ONLY renames for maximum git rename detection during future rebases of open PRs.
0 parents  commit 4a99008

94 files changed

Lines changed: 20869 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
vendor/*
2+
cache/*
3+
.git/*

.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
text=auto
2+
3+
# disable auto line ending conversion
4+
*.csv binary

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Jira: CT-XXX
2+
KBC: XXX
3+
4+
Before asking for review make sure that:
5+
6+
## Checklist
7+
8+
- [ ] New client method(s) has tests
9+
- [ ] New client method(s) support branches, or they are listed in BranchAwareClient
10+
- [ ] Apiary file is updated
11+
12+
## Release
13+
14+
- [ ] I gave the PR a proper label:
15+
* major (BC break)
16+
* minor (new feature)
17+
* patch (backwards compatible fix)
18+
* no release (just test changes)

.github/workflows/master.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Build on master
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
-
13+
name: Checkout
14+
uses: actions/checkout@v4
15+
-
16+
name: Build docker image
17+
env:
18+
DRIVER_DOWNLOADS_ACCESS_KEY_ID: ${{ secrets.DRIVER_DOWNLOADS_ACCESS_KEY_ID }}
19+
DRIVER_DOWNLOADS_SECRET_ACCESS_KEY: ${{ secrets.DRIVER_DOWNLOADS_SECRET_ACCESS_KEY }}
20+
run: |
21+
docker compose build tests
22+
docker network create connection_api-tests
23+
docker compose run --rm tests php -v
24+
docker compose run --rm tests composer ci
25+
-
26+
name: List images
27+
run: docker images
28+
-
29+
name: Login to quay.io
30+
uses: docker/login-action@v1
31+
with:
32+
registry: quay.io
33+
username: ${{ secrets.QUAY_USERNAME }}
34+
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
35+
-
36+
name: Tag and push to quay.io
37+
run: |
38+
docker tag keboola/storage-api-tests quay.io/keboola/storage-api-tests:latest
39+
docker push quay.io/keboola/storage-api-tests:latest

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.idea
2+
apidoc
3+
cache.properties
4+
config.php
5+
composer.lock
6+
composer.phar
7+
vendor
8+
*.kdev4
9+
.kdev4
10+
.env
11+
REVISION
12+
/cache
13+
.phpunit.result.cache

Dockerfile

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
ARG PHP_VERSION=8.2
2+
# the default env bellow is used when build pipeline sends "PHP_VERSION=" - the above default value is ignored in that case
3+
FROM php:${PHP_VERSION:-8.2}-cli-bullseye AS dev
4+
MAINTAINER Martin Halamicek <martin@keboola.com>
5+
ENV DEBIAN_FRONTEND noninteractive
6+
ARG COMPOSER_FLAGS="--prefer-dist --no-interaction"
7+
ARG SNOWFLAKE_ODBC_VERSION=3.4.1
8+
ARG SNOWFLAKE_GPG_KEY=630D9F3CAB551AF3
9+
ENV COMPOSER_ALLOW_SUPERUSER 1
10+
ENV COMPOSER_PROCESS_TIMEOUT 3600
11+
ARG SYNAPSE_ODBC_VERSION=5.12.0
12+
13+
WORKDIR /code/
14+
15+
COPY docker/composer-install.sh /tmp/composer-install.sh
16+
17+
# Locale
18+
ENV LC_CTYPE=C.UTF-8
19+
ENV LC_ALL=C.UTF-8
20+
ENV LANG=C.UTF-8
21+
22+
RUN apt-get update -q \
23+
&& apt-get update -q \
24+
&& ACCEPT_EULA=Y apt-get install \
25+
unzip \
26+
git \
27+
libpq-dev \
28+
-y --no-install-recommends \
29+
&& rm -r /var/lib/apt/lists/* \
30+
&& chmod +x /tmp/composer-install.sh \
31+
&& /tmp/composer-install.sh
32+
33+
RUN echo "memory_limit = -1" >> /usr/local/etc/php/php.ini
34+
35+
36+
# snowflake - charset settings
37+
ENV LANG en_US.UTF-8
38+
39+
WORKDIR /code
40+
41+
## Composer - deps always cached unless changed
42+
# First copy only composer files
43+
COPY composer.* ./
44+
# Download dependencies, but don't run scripts or init autoloaders as the app is missing
45+
RUN composer install $COMPOSER_FLAGS --no-scripts --no-autoloader
46+
# copy rest of the app
47+
COPY . .
48+
# run normal composer - all deps are cached already
49+
RUN composer install $COMPOSER_FLAGS

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) Keboola :(){:|:&};: s.r.o.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Keboola Storage API PHP Client
2+
3+
[![Latest Stable Version](https://poser.pugx.org/keboola/storage-api-client/v/stable.svg)](https://packagist.org/packages/keboola/storage-api-client)
4+
[![License](https://poser.pugx.org/keboola/storage-api-client/license.svg)](https://packagist.org/packages/keboola/storage-api-client)
5+
[![Total Downloads](https://poser.pugx.org/keboola/storage-api-client/downloads.svg)](https://packagist.org/packages/keboola/storage-api-client)
6+
[![Build on tag](https://github.com/keboola/storage-api-php-client/actions/workflows/tag.yml/badge.svg)](https://github.com/keboola/storage-api-php-client/actions/workflows/tag.yml)
7+
8+
Simple PHP wrapper library for [Keboola Storage API](http://docs.keboola.apiary.io/).
9+
10+
## Installation
11+
12+
Library is available as composer package.
13+
To start using composer in your project follow these steps:
14+
15+
**Install composer**
16+
17+
```bash
18+
curl -s http://getcomposer.org/installer | php
19+
mv ./composer.phar ~/bin/composer # or /usr/local/bin/composer
20+
```
21+
22+
**Create composer.json file in your project root folder:**
23+
```json
24+
{
25+
"require": {
26+
"php" : ">=8.1",
27+
"keboola/storage-api-client": "^14.0"
28+
}
29+
}
30+
```
31+
32+
**Install package:**
33+
34+
```bash
35+
composer install
36+
```
37+
38+
**Add autoloader in your bootstrap script:**
39+
40+
```php
41+
require 'vendor/autoload.php';
42+
```
43+
44+
Read more in [Composer documentation](http://getcomposer.org/doc/01-basic-usage.md).
45+
46+
## Usage examples
47+
48+
Table write:
49+
50+
```php
51+
require 'vendor/autoload.php';
52+
53+
use Keboola\StorageApi\Client;
54+
use Keboola\Csv\CsvFile;
55+
56+
$client = new Client([
57+
'token' => 'YOUR_TOKEN',
58+
'url' => 'https://connection.keboola.com'
59+
]);
60+
$csvFile = new CsvFile(__DIR__ . '/my.csv', ',', '"');
61+
$client->writeTableAsync('in.c-main.my-table', $csvFile);
62+
```
63+
64+
Table export to file:
65+
66+
```php
67+
require 'vendor/autoload.php';
68+
69+
use Keboola\StorageApi\Client;
70+
use Keboola\StorageApi\TableExporter;
71+
72+
$client = new Client([
73+
'token' => 'YOUR_TOKEN',
74+
'url' => 'https://connection.keboola.com'
75+
]);
76+
77+
$exporter = new TableExporter($client);
78+
$exporter->exportTable('in.c-main.my-table', './in.c-main.my-table.csv', []);
79+
80+
```
81+
82+
## License
83+
84+
See [LICENSE](./LICENSE) file.

0 commit comments

Comments
 (0)