@@ -62,11 +62,12 @@ In your code you should type-hint to `Storyblok\Api\StoriesApiInterface`
62
62
``` php
63
63
use Storyblok\Api\StoriesApi;
64
64
use Storyblok\Api\StoryblokClient;
65
+ use Storyblok\Api\Request\StoriesRequest;
65
66
66
67
$client = new StoryblokClient(/* ... */);
67
68
68
69
$storiesApi = new StoriesApi($client);
69
- $response = $storiesApi->all(locale : 'de');
70
+ $response = $storiesApi->all(new StoriesRequest(language : 'de') );
70
71
```
71
72
72
73
### Fetch by Version (` draft ` , ` published ` )
@@ -77,14 +78,14 @@ $response = $storiesApi->all(locale: 'de');
77
78
use Storyblok\Api\StoriesApi;
78
79
use Storyblok\Api\StoryblokClient;
79
80
use Storyblok\Api\Domain\Value\Dto\Version;
81
+ use Storyblok\Api\Request\StoryRequest;
80
82
81
83
$client = new StoryblokClient(/* ... */);
82
84
83
85
$storiesApi = new StoriesApi($client, Version::Draft);
84
- $response = $storiesApi->bySlug(
85
- locale: 'de',
86
- slug: '/my-story/',
87
- );
86
+ $response = $storiesApi->bySlug('/my-story/', new StoryRequest(
87
+ language: 'de',
88
+ ));
88
89
```
89
90
90
91
#### Method Call
@@ -93,15 +94,15 @@ $response = $storiesApi->bySlug(
93
94
use Storyblok\Api\StoriesApi;
94
95
use Storyblok\Api\StoryblokClient;
95
96
use Storyblok\Api\Domain\Value\Dto\Version;
97
+ use Storyblok\Api\Request\StoryRequest;
96
98
97
99
$client = new StoryblokClient(/* ... */);
98
100
99
101
$storiesApi = new StoriesApi($client, Version::Published);
100
- $response = $storiesApi->bySlug(
101
- locale: 'de',
102
- slug: '/my-story/',
102
+ $response = $storiesApi->bySlug('/my-story/', new StoryRequest(
103
+ language: 'de',
103
104
version: Version::Draft, // This overrides the global "version"
104
- );
105
+ )) ;
105
106
```
106
107
107
108
### Pagination
@@ -110,14 +111,15 @@ $response = $storiesApi->bySlug(
110
111
use Storyblok\Api\StoriesApi;
111
112
use Storyblok\Api\StoryblokClient;
112
113
use Storyblok\Api\Domain\Value\Dto\Pagination;
114
+ use Storyblok\Api\Request\StoriesRequest;
113
115
114
116
$client = new StoryblokClient(/* ... */);
115
117
116
118
$storiesApi = new StoriesApi($client);
117
- $response = $storiesApi->all(
118
- locale : 'de',
119
+ $response = $storiesApi->all(new StoriesRequest(
120
+ language : 'de',
119
121
pagination: new Pagination(page: 1, perPage: 30)
120
- );
122
+ )) ;
121
123
```
122
124
123
125
#### Sorting
@@ -127,14 +129,15 @@ use Storyblok\Api\StoriesApi;
127
129
use Storyblok\Api\StoryblokClient;
128
130
use Storyblok\Api\Domain\Value\Dto\SortBy;
129
131
use Storyblok\Api\Domain\Value\Dto\Direction;
132
+ use Storyblok\Api\Request\StoriesRequest;
130
133
131
134
$client = new StoryblokClient(/* ... */);
132
135
133
136
$storiesApi = new StoriesApi($client);
134
- $response = $storiesApi->all(
135
- locale : 'de',
137
+ $response = $storiesApi->all(new StoriesRequest(
138
+ language : 'de',
136
139
sortBy: new SortBy(field: 'title', direction: Direction::Desc)
137
- );
140
+ )) ;
138
141
```
139
142
140
143
#### Filtering
@@ -145,16 +148,17 @@ use Storyblok\Api\StoryblokClient;
145
148
use Storyblok\Api\Domain\Value\Filter\FilterCollection;
146
149
use Storyblok\Api\Domain\Value\Dto\Direction;
147
150
use Storyblok\Api\Domain\Value\Filter\Filters\InFilter;
151
+ use Storyblok\Api\Request\StoriesRequest;
148
152
149
153
$client = new StoryblokClient(/* ... */);
150
154
151
155
$storiesApi = new StoriesApi($client);
152
- $response = $storiesApi->all(
153
- locale : 'de',
156
+ $response = $storiesApi->all(new StoriesRequest(
157
+ language : 'de',
154
158
filters: new FilterCollection([
155
159
new InFilter(field: 'single_reference_field', value: 'f2fdb571-a265-4d8a-b7c5-7050d23c2383')
156
160
])
157
- );
161
+ )) ;
158
162
```
159
163
160
164
#### Available filters
@@ -310,11 +314,14 @@ new OrFilter(
310
314
``` php
311
315
use Storyblok\Api\StoriesApi;
312
316
use Storyblok\Api\StoryblokClient;
317
+ use Storyblok\Api\Request\StoriesRequest;
313
318
314
319
$client = new StoryblokClient(/* ... */);
315
320
316
321
$storiesApi = new StoriesApi($client);
317
- $response = $storiesApi->allByContentType('custom_content_type', locale: 'de');
322
+ $response = $storiesApi->allByContentType('custom_content_type', new StoriesRequest(
323
+ language: 'de',
324
+ ));
318
325
```
319
326
320
327
### Get by uuid (` Storyblok\Api\Domain\Value\Uuid ` )
@@ -323,25 +330,31 @@ $response = $storiesApi->allByContentType('custom_content_type', locale: 'de');
323
330
use Storyblok\Api\StoriesApi;
324
331
use Storyblok\Api\StoryblokClient;
325
332
use Storyblok\Api\Domain\Value\Uuid;
333
+ use Storyblok\Api\Request\StoryRequest;
326
334
327
335
$uuid = new Uuid(/** ... */);
328
336
329
337
$client = new StoryblokClient(/* ... */);
330
338
331
339
$storiesApi = new StoriesApi($client);
332
- $response = $storiesApi->byUuid($uuid, locale: 'de');
340
+ $response = $storiesApi->byUuid($uuid, new StoryRequest(
341
+ language: 'de',
342
+ ));
333
343
```
334
344
335
345
### Get by slug (` string ` )
336
346
337
347
``` php
338
348
use Storyblok\Api\StoriesApi;
339
349
use Storyblok\Api\StoryblokClient;
350
+ use Storyblok\Api\Request\StoryRequest;
340
351
341
352
$client = new StoryblokClient(/* ... */);
342
353
343
354
$storiesApi = new StoriesApi($client);
344
- $response = $storiesApi->bySlug('folder/slug', locale: 'de');
355
+ $response = $storiesApi->bySlug('folder/slug', new StoryRequest(
356
+ language: 'de',
357
+ ));
345
358
```
346
359
347
360
@@ -351,13 +364,16 @@ $response = $storiesApi->bySlug('folder/slug', locale: 'de');
351
364
use Storyblok\Api\StoriesApi;
352
365
use Storyblok\Api\StoryblokClient;
353
366
use Storyblok\Api\Domain\Value\Id;
367
+ use Storyblok\Api\Request\StoryRequest;
354
368
355
369
$id = new Id(/** ... */);
356
370
357
371
$client = new StoryblokClient(/* ... */);
358
372
359
373
$storiesApi = new StoriesApi($client);
360
- $response = $storiesApi->byId($id, locale: 'de');
374
+ $response = $storiesApi->byId($id, new StoryRequest(
375
+ language: 'de',
376
+ ));
361
377
```
362
378
363
379
@@ -383,13 +399,14 @@ $response = $linksApi->all();
383
399
use Storyblok\Api\LinksApi;
384
400
use Storyblok\Api\StoryblokClient;
385
401
use Storyblok\Api\Domain\Value\Dto\Pagination;
402
+ use Storyblok\Api\Request\LinksRequest;
386
403
387
404
$client = new StoryblokClient(/* ... */);
388
405
389
406
$linksApi = new LinksApi($client);
390
- $response = $linksApi->all(
407
+ $response = $linksApi->all(new LinksRequest(
391
408
pagination: new Pagination(page: 1, perPage: 1000)
392
- );
409
+ )) ;
393
410
```
394
411
395
412
### Get by parent (` Storyblok\Api\Domain\Value\Id ` )
0 commit comments