diff --git a/.github/README.template.md b/.github/README.template.md index a181b9b..6f4e767 100644 --- a/.github/README.template.md +++ b/.github/README.template.md @@ -8,6 +8,23 @@ composer require cedricziel/baserow ## Docs +```php +use CedricZiel\Baserow\Generated\Client; + +$baserow = Client::create(null, [ + // optional, default is baserow.io + new AddHostPlugin(new Uri('https://my-baserow.example.com')), + + // use ONE of DatabaseTokenAuthentication + new DatabaseTokenAuthentication('YOUR_TOKEN'), + // OR JWTAuthentication + new JWTAuthentication('JWT Token'), +]); + +// list all rows in table id 42 +$client->listDatabaseTableRows(42); +``` + ### docs ### ## License diff --git a/.github/workflows/client-generate.yml b/.github/workflows/client-generate.yml index 69bdd1b..660fa08 100644 --- a/.github/workflows/client-generate.yml +++ b/.github/workflows/client-generate.yml @@ -2,6 +2,8 @@ name: Generate API client on: push: + branches: + - main pull_request: permissions: diff --git a/README.md b/README.md index 13e8667..a7218f2 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,23 @@ composer require cedricziel/baserow ## Docs +```php +use CedricZiel\Baserow\Generated\Client; + +$baserow = Client::create(null, [ + // optional, default is baserow.io + new AddHostPlugin(new Uri('https://my-baserow.example.com')), + + // use ONE of DatabaseTokenAuthentication + new DatabaseTokenAuthentication('YOUR_TOKEN'), + // OR JWTAuthentication + new JWTAuthentication('JWT Token'), +]); + +// list all rows in table id 42 +$client->listDatabaseTableRows(42); +``` + ### email_tester - post /api/_health/email/ diff --git a/src/Authentication/DatabaseTokenAuthentication.php b/src/Authentication/DatabaseTokenAuthentication.php index 943a878..f70b346 100644 --- a/src/Authentication/DatabaseTokenAuthentication.php +++ b/src/Authentication/DatabaseTokenAuthentication.php @@ -15,7 +15,7 @@ public function __construct(string $token) public function authentication(\Psr\Http\Message\RequestInterface $request): \Psr\Http\Message\RequestInterface { - $header = sprintf('Bearer %s', $this->{'token'}); + $header = sprintf('Token %s', $this->{'token'}); $request = $request->withHeader('Authorization', $header); return $request;