Skip to content

Commit db7cb87

Browse files
committed
Add docs for batch request factory method
1 parent f9e7d99 commit db7cb87

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

docs/reference/Facebook.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,23 @@ $batchResponse = $fb->sendBatchRequest($requests);
349349

350350
[See a full batch example](../examples/batch_request.md).
351351

352+
## newBatchRequest()
353+
```php
354+
public Facebook\FacebookBatchRequest newBatchRequest(
355+
string|AccessToken|null $accessToken,
356+
string|null $graphVersion
357+
)
358+
```
359+
360+
Instantiates an empty `Facebook\FacebookBatchRequest`.
361+
To populate it use the [`Facebook\FacebookBatchRequest::add()`](FacebookBatchRequest.md#add) method.
362+
363+
The `$accessToken` and `$graphVersion` arguments are the same as `get()` above.
364+
If any of the requests contained in the batch request does not have either the `$accessToken` or the `$graphVersion` set,
365+
it fallbacks to the values provided in the instantiation of the batch request.
366+
367+
[See a full batch example](../examples/batch_request.md).
368+
352369
## getRedirectLoginHelper()
353370
```php
354371
public Facebook\Helpers\FacebookRedirectLoginHelper getRedirectLoginHelper()

docs/reference/FacebookBatchRequest.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ Represents a batch request that will be sent to the Graph API.
44

55
## Facebook\FacebookBatchRequest
66

7-
You can instantiate a new `FacebookBatchRequest` entity directly by sending the arguments to the constructor.
7+
You can instantiate a new `FacebookBatchRequest` entity directly by sending the arguments to the constructor or
8+
by using the [`Facebook\Facebook::newBatchRequest()`](Facebook.md#newBatchRequest) factory method.
89

910
```php
1011
use Facebook\FacebookBatchRequest;

0 commit comments

Comments
 (0)