Skip to content

Commit

Permalink
fix: fix database token header prefix name (#12)
Browse files Browse the repository at this point in the history
* fix: fix database token header prefix name

Signed-off-by: Cedric Ziel <cedric@cedric-ziel.com>

* doc: amend readme on how to use

* fix: limit branches to generate on

* Apply php-cs-fixer changes

---------

Signed-off-by: Cedric Ziel <cedric@cedric-ziel.com>
Co-authored-by: cedricziel <cedricziel@users.noreply.github.com>
  • Loading branch information
cedricziel and cedricziel authored Aug 4, 2024
1 parent 63223cf commit c7c364c
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
17 changes: 17 additions & 0 deletions .github/README.template.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/client-generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Generate API client

on:
push:
branches:
- main
pull_request:

permissions:
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/


Expand Down
2 changes: 1 addition & 1 deletion src/Authentication/DatabaseTokenAuthentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c7c364c

Please sign in to comment.