Skip to content

Commit e128419

Browse files
committed
WIP
1 parent c17cbda commit e128419

File tree

2 files changed

+92
-16
lines changed

2 files changed

+92
-16
lines changed

README.md

+91-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<img src="https://banners.beyondco.de/Laravel%20Beekeeper.png?theme=light&packageManager=composer+require&packageName=codebar-ag%2Flaravel-beekeeper&pattern=circuitBoard&style=style_1&description=An+opinionated+way+to+integrate+Beekeeper+with+Laravel&md=1&showWatermark=0&fontSize=175px&images=photograph">
1+
<img src="https://banners.beyondco.de/Laravel%20Beekeeper.png?theme=light&packageManager=composer+require&packageName=codebar-ag%2Flaravel-beekeeper&pattern=architect&style=style_1&description=An+opinionated+way+to+integrate+Beekeeper+with+Laravel&md=1&showWatermark=0&fontSize=100px&images=cloud">
22

33

44

@@ -18,6 +18,11 @@ Beekeeper Api. It is used to query the most common endpoints.
1818
* [🛠 Requirements](#-requirements)
1919
* [Installation](#installation)
2020
* [Usage](#usage)
21+
* [Get the connector](#get-the-connector)
22+
* [Get The Status Of The Authenticated User](#get-the-status-of-the-authenticated-user)
23+
* [List Artifacts](#list-artifacts)
24+
* [Upload A File](#upload-a-file)
25+
* [Create A Child To An Artifact](#create-a-child-to-an-artifact)
2126
* [DTO Showcase](#dto-showcase)
2227
* [Testing](#testing)
2328
* [Changelog](#changelog)
@@ -76,22 +81,95 @@ BEEKEEPER_CACHE_STORE=beekeeper
7681

7782
## Usage
7883

84+
### Get the connector
85+
86+
```php
87+
use CodebarAg\LaravelBeekeeper\Connectors\BeekeeperConnector;
88+
89+
// Using the env variables
90+
$connector = new BeekeeperConnector;
91+
92+
// Passing the credentials manually
93+
$connector = new BeekeeperConnector(
94+
apiToken: $yourApiToken,
95+
endpointPrefix: 'foobar.us',
96+
);
97+
```
98+
99+
### Get The Status Of The Authenticated User
100+
101+
```php
102+
use CodebarAg\LaravelBeekeeper\Requests\GetStatusOfAuthenticatedUserRequest;
103+
104+
$response = $connector->send(new GetStatusOfAuthenticatedUserRequest);
105+
````
106+
107+
### List Artifacts
108+
109+
```php
110+
use CodebarAg\LaravelBeekeeper\Requests\ListArtifacts;
111+
112+
$response = $connector->send(new ListArtifacts(
113+
type: Type::FOLDER,
114+
sort: Sort::NAME_ASC,
115+
limit: 20,
116+
));
117+
```
118+
119+
### Upload A File
120+
121+
```php
122+
use CodebarAg\LaravelBeekeeper\Requests\UploadAFileRequest;
123+
124+
$fileContent = file_get_contents('path-to/foobar.pdf');
125+
$fileName = 'foobar.pdf';
126+
127+
$response = $connector->send(new UploadAFileRequest(
128+
fileContent: $fileContent,
129+
fileName: $fileName,
130+
));
131+
```
132+
133+
### Create A Child To An Artifact
134+
135+
```php
136+
use CodebarAg\LaravelBeekeeper\Requests\CreateAChildToAnArtifact;
137+
use CodebarAg\LaravelBeekeeper\Enums\Artifacts\Type;
138+
139+
$response = $connector->send(new CreateAChildToAnArtifact(
140+
artifactId: '12345678-abcd-efgh-9012-de00edbf7b0b',
141+
name: 'foobar.pdf',
142+
type: Type::FILE,
143+
parentId: '12345678-abcd-efgh-9012-de00edbf7b0b',
144+
metadata: [
145+
'mimeType' => 'image/png',
146+
'url' => 'https://foobar.us.beekeeper.io/api/2/files/key/12345678-abcd-efgh-9012-de00edbf7b0b',
147+
'userId' => '12345678-abcd-efgh-9012-de00edbf7b0b',
148+
'key' => '12345678-abcd-efgh-9012-de00edbf7b0b',
149+
'id' => 12345678,
150+
'size' => 123456,
151+
],
152+
adjustArtifactName: false,
153+
expand: []
154+
));
155+
```
156+
79157
## DTO Showcase
80158

81159
```php
82160
CodebarAg\LaravelBeekeeper\Data\Artifacts\Artifact {
83-
+id: "12345678-abcd-efgh-9012-de00edbf7b0b" // string
84-
+tenantId: "12345" // string
85-
+name: "Documents" // string
86-
+type: CodebarAg\LaravelBeekeeper\Enums\Artifacts\Type // Type
87-
+parentId: null // string|null
88-
+metadata: Illuminate\Support\Collection // Collection
89-
+createdAt: Carbon\CarbonImmutable // CarbonImmutable
90-
+updatedAt: Carbon\CarbonImmutable // CarbonImmutable
91-
+breadcrumbs: Illuminate\Support\Collection // Collection
92-
+children: Illuminate\Support\Collection // Collection
93-
+acl: Illuminate\Support\Collection // Collection
94-
+filterData: Illuminate\Support\Collection // Collection
161+
+id: "12345678-abcd-efgh-9012-de00edbf7b0b" // string
162+
+tenantId: "12345" // string
163+
+name: "Documents" // string
164+
+type: CodebarAg\LaravelBeekeeper\Enums\Artifacts\Type // Type
165+
+parentId: null // string|null
166+
+metadata: Illuminate\Support\Collection // Collection
167+
+createdAt: Carbon\CarbonImmutable // CarbonImmutable
168+
+updatedAt: Carbon\CarbonImmutable // CarbonImmutable
169+
+breadcrumbs: Illuminate\Support\Collection // Collection
170+
+children: Illuminate\Support\Collection // Collection
171+
+acl: Illuminate\Support\Collection // Collection
172+
+filterData: Illuminate\Support\Collection // Collection
95173
}
96174
```
97175

tests/Feature/Requests/UploadAFileRequestTest.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121

2222
$uploadAFile = $response->dto();
2323

24-
ray($uploadAFile);
25-
2624
expect($uploadAFile)->toBeInstanceOf(File::class)
2725
->and($uploadAFile->name)->toBe($fileName)
2826
->and($uploadAFile->status)->toBe(Status::READY)
@@ -39,4 +37,4 @@
3937
->and($uploadAFile->id)->toBeInt()
4038
->and($uploadAFile->size)->toBe(strlen($fileContent))
4139
->and($uploadAFile->versions)->toBeInstanceOf(Collection::class);
42-
})->group('upload')->only();
40+
})->group('upload');

0 commit comments

Comments
 (0)