Skip to content

Commit 648bc86

Browse files
committed
Add some documentation
1 parent b07a7da commit 648bc86

File tree

1 file changed

+95
-0
lines changed

1 file changed

+95
-0
lines changed

doc/organization/webhooks.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
## Organization / Webhooks API
2+
[Back to the navigation](README.md)
3+
4+
Listing, showing, creating, updating, testing and removing organizations webhooks.
5+
Wraps [GitHub Organization Webhooks API](https://developer.github.com/v3/orgs/hooks/).
6+
7+
Additional APIs:
8+
* [Organization](issue/organization.md)
9+
10+
### List webhooks for an organization
11+
12+
> Requires [authentication](security.md).
13+
14+
```php
15+
$webhooks = $client->organization()->all('KnpLabs');
16+
```
17+
18+
Returns an array of webhooks for the organization.
19+
20+
### Get a webhook for an organization
21+
22+
> Requires [authentication](security.md).
23+
24+
```php
25+
$webhook = $client->organization()->show('KnpLabs', 123);
26+
```
27+
28+
Returns the webhook with the ID 123 as an array for the organization.
29+
30+
### Create a new webhook for an organization
31+
32+
> Requires [authentication](security.md).
33+
34+
```php
35+
$webhook = $client->organization()->create('KnpLabs', array(
36+
'name' => 'web',
37+
'active' => true,
38+
'events' => array(
39+
'push',
40+
'pull_request'
41+
),
42+
'config' => array(
43+
'url' => 'http=>//example.com/webhook',
44+
'content_type' => 'json'
45+
)
46+
));
47+
```
48+
49+
Creates a new webhook for the organization.
50+
*name* and *url* parameters are required.
51+
52+
The create webhook will be returned as an array.
53+
54+
### Update an existing webhook for an organization
55+
56+
> Requires [authentication](security.md).
57+
58+
```php
59+
$success = $client->organization()->update('KnpLabs', 123, array(
60+
'active' => true,
61+
'events' => array(
62+
'push',
63+
'pull_request'
64+
),
65+
'config' => array(
66+
'url' => 'http=>//example.com/webhook',
67+
'content_type' => 'json'
68+
)
69+
));
70+
```
71+
72+
Update an existing webhook with ID 123 for the organization.
73+
*url* parameter is required.
74+
75+
In case of success, an array of informations about the webhook will be returned.
76+
77+
### Ping a webhook for an organization
78+
79+
> Requires [authentication](security.md).
80+
81+
```php
82+
$client->organization()->pings('KnpLabs', 123);
83+
```
84+
85+
No content is returned.
86+
87+
### Delete a webhook for an organization
88+
89+
> Requires [authentication](security.md).
90+
91+
```php
92+
$client->organization()->delete('KnpLabs', 123);
93+
```
94+
95+
No content is returned.

0 commit comments

Comments
 (0)