Skip to content

Commit bfbd53a

Browse files
committed
Added usage guidelines
1 parent ababd69 commit bfbd53a

1 file changed

Lines changed: 63 additions & 2 deletions

File tree

readme.md

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,69 @@ Once you got your access token, open the `config/services.php` in your laravel p
3333
]
3434

3535

36-
The package will automatically pick out the token to authenticate any Api call to your own intercom data.
36+
The package will automatically pick out the token to authenticate any api request to your own intercom data.
3737

38+
## Usage
39+
40+
You can resolve the intercom `Client` in many ways:
41+
42+
```php
43+
use Mediumart\Intercom\Client;
44+
45+
/**
46+
* Manually resolving from the container
47+
* */
48+
$intercom = app('intercom');
49+
// or
50+
$intercom = app(Client::class);
51+
52+
53+
/**
54+
* using type hinting and laravel's automatic resolution
55+
* */
56+
public function index(Client $intercom)
57+
{
58+
/.../
59+
}
60+
61+
62+
/**
63+
* Simply leverage the facade
64+
* */
65+
$intercomUsers = Intercom::users();
66+
```
67+
68+
Using the `intance` or the `facade`, any resource type is mirrored as a method on the `Client`, that can be used to gain the corresponding resource object :
69+
```php
70+
// facade
71+
$leads = Intercom::leads();
72+
73+
// instance
74+
$intercom = app('intercom');
75+
$conversations = $intercom->conversations();
76+
```
77+
Using the `intance` approach you can also resolve the resource instance as a property of the `Client`:
78+
```php
79+
$conversations = $intercom->conversations;
80+
```
81+
82+
Here is the list of all the Intercom resources types :
83+
84+
- `users`
85+
- `events`
86+
- `companies`
87+
- `messages`
88+
- `conversations`
89+
- `leads`
90+
- `admins`
91+
- `tags`
92+
- `segments`
93+
- `counts`
94+
- `bulk`
95+
- `notes`
96+
97+
You can find related informations on their [official documentation page](https://developers.intercom.com/v2.0/reference#introduction).
98+
3899
## License
39100

40-
Mediumart Intercom is an open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).
101+
Mediumart Intercom is an open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).

0 commit comments

Comments
 (0)