Skip to content

Commit

Permalink
docs(docs): add additional code examples to README.md
Browse files Browse the repository at this point in the history
- Added new code examples for sending messages asynchronously.
- Provided examples for creating a pool of messages and handling responses.
  • Loading branch information
guanguans committed Jul 9, 2024
1 parent 9492bb4 commit c6e2930
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
## Platform support

[//]: # (https://github.com/dschep/ntfy)

* [AnPush](./src/AnPush/README.md)
* [Bark](./src/Bark/README.md)
* [Chanify](./src/Chanify/README.md)
Expand Down Expand Up @@ -63,6 +64,8 @@ composer require guanguans/notify -v

## Usage example

### Quick start

```php
// 1. Create authenticator
$authenticator = new Guanguans\Notify\DingTalk\Authenticator(
Expand Down Expand Up @@ -118,6 +121,21 @@ $response = $client
->json();
```

### Asynchronous requests

```php
$promise = $client->sendAsync($message);
$response = $promise->wait();
```

### Concurrent requests

```php
/** @var list<\Guanguans\Notify\Foundation\Contracts\Message> $messages */
/** @var list<\Guanguans\Notify\Foundation\Response|\Psr\Http\Message\ResponseInterface> $responses */
$responses = $client->pool($messages);
```

## Testing

```bash
Expand Down

0 comments on commit c6e2930

Please sign in to comment.