Issues (54)

src/thirdparty/Mandrill/Webhooks.php (1 issue)

Labels
Severity
1
<?php
2
3
class Mandrill_Webhooks
4
{
5
6
    private $master;
7
8
    public function __construct(Mandrill $master)
9
    {
10
        $this->master = $master;
11
    }
12
13
    /**
14
     * Get the list of all webhooks defined on the account
15
     * @return array the webhooks associated with the account
16
     *     - return[] struct the individual webhook info
17
     *         - id integer a unique integer indentifier for the webhook
18
     *         - url string The URL that the event data will be posted to
19
     *         - description string a description of the webhook
20
     *         - auth_key string the key used to requests for this webhook
21
     *         - events array The message events that will be posted to the hook
22
     *             - events[] string the individual message event (send, hard_bounce, soft_bounce, open, click, spam, unsub, or reject)
23
     *         - created_at string the date and time that the webhook was created as a UTC string in YYYY-MM-DD HH:MM:SS format
24
     *         - last_sent_at string the date and time that the webhook last successfully received events as a UTC string in YYYY-MM-DD HH:MM:SS format
25
     *         - batches_sent integer the number of event batches that have ever been sent to this webhook
26
     *         - events_sent integer the total number of events that have ever been sent to this webhook
27
     *         - last_error string if we've ever gotten an error trying to post to this webhook, the last error that we've seen
28
     */
29
    public function getList()
30
    {
31
        $_params = array();
32
        return $this->master->call('webhooks/list', $_params);
33
    }
34
35
    /**
36
     * Add a new webhook
37
     * @param string $url the URL to POST batches of events
38
     * @param string $description an optional description of the webhook
39
     * @param array $events an optional list of events that will be posted to the webhook
40
     *     - events[] string the individual event to listen for
41
     * @return struct the information saved about the new webhook
0 ignored issues
show
The type struct was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
42
     *     - id integer a unique integer indentifier for the webhook
43
     *     - url string The URL that the event data will be posted to
44
     *     - description string a description of the webhook
45
     *     - auth_key string the key used to requests for this webhook
46
     *     - events array The message events that will be posted to the hook
47
     *         - events[] string the individual message event (send, hard_bounce, soft_bounce, open, click, spam, unsub, or reject)
48
     *     - created_at string the date and time that the webhook was created as a UTC string in YYYY-MM-DD HH:MM:SS format
49
     *     - last_sent_at string the date and time that the webhook last successfully received events as a UTC string in YYYY-MM-DD HH:MM:SS format
50
     *     - batches_sent integer the number of event batches that have ever been sent to this webhook
51
     *     - events_sent integer the total number of events that have ever been sent to this webhook
52
     *     - last_error string if we've ever gotten an error trying to post to this webhook, the last error that we've seen
53
     */
54
    public function add($url, $description = null, $events = array())
55
    {
56
        $_params = array("url" => $url, "description" => $description, "events" => $events);
57
        return $this->master->call('webhooks/add', $_params);
58
    }
59
60
    /**
61
     * Given the ID of an existing webhook, return the data about it
62
     * @param int $id the unique identifier of a webhook belonging to this account
63
     * @return struct the information about the webhook
64
     *     - id integer a unique integer indentifier for the webhook
65
     *     - url string The URL that the event data will be posted to
66
     *     - description string a description of the webhook
67
     *     - auth_key string the key used to requests for this webhook
68
     *     - events array The message events that will be posted to the hook
69
     *         - events[] string the individual message event (send, hard_bounce, soft_bounce, open, click, spam, unsub, or reject)
70
     *     - created_at string the date and time that the webhook was created as a UTC string in YYYY-MM-DD HH:MM:SS format
71
     *     - last_sent_at string the date and time that the webhook last successfully received events as a UTC string in YYYY-MM-DD HH:MM:SS format
72
     *     - batches_sent integer the number of event batches that have ever been sent to this webhook
73
     *     - events_sent integer the total number of events that have ever been sent to this webhook
74
     *     - last_error string if we've ever gotten an error trying to post to this webhook, the last error that we've seen
75
     */
76
    public function info($id)
77
    {
78
        $_params = array("id" => $id);
79
        return $this->master->call('webhooks/info', $_params);
80
    }
81
82
    /**
83
     * Update an existing webhook
84
     * @param int $id the unique identifier of a webhook belonging to this account
85
     * @param string $url the URL to POST batches of events
86
     * @param string $description an optional description of the webhook
87
     * @param array $events an optional list of events that will be posted to the webhook
88
     *     - events[] string the individual event to listen for
89
     * @return struct the information for the updated webhook
90
     *     - id integer a unique integer indentifier for the webhook
91
     *     - url string The URL that the event data will be posted to
92
     *     - description string a description of the webhook
93
     *     - auth_key string the key used to requests for this webhook
94
     *     - events array The message events that will be posted to the hook
95
     *         - events[] string the individual message event (send, hard_bounce, soft_bounce, open, click, spam, unsub, or reject)
96
     *     - created_at string the date and time that the webhook was created as a UTC string in YYYY-MM-DD HH:MM:SS format
97
     *     - last_sent_at string the date and time that the webhook last successfully received events as a UTC string in YYYY-MM-DD HH:MM:SS format
98
     *     - batches_sent integer the number of event batches that have ever been sent to this webhook
99
     *     - events_sent integer the total number of events that have ever been sent to this webhook
100
     *     - last_error string if we've ever gotten an error trying to post to this webhook, the last error that we've seen
101
     */
102
    public function update($id, $url, $description = null, $events = array())
103
    {
104
        $_params = array("id" => $id, "url" => $url, "description" => $description, "events" => $events);
105
        return $this->master->call('webhooks/update', $_params);
106
    }
107
108
    /**
109
     * Delete an existing webhook
110
     * @param int $id the unique identifier of a webhook belonging to this account
111
     * @return struct the information for the deleted webhook
112
     *     - id integer a unique integer indentifier for the webhook
113
     *     - url string The URL that the event data will be posted to
114
     *     - description string a description of the webhook
115
     *     - auth_key string the key used to requests for this webhook
116
     *     - events array The message events that will be posted to the hook
117
     *         - events[] string the individual message event (send, hard_bounce, soft_bounce, open, click, spam, unsub, or reject)
118
     *     - created_at string the date and time that the webhook was created as a UTC string in YYYY-MM-DD HH:MM:SS format
119
     *     - last_sent_at string the date and time that the webhook last successfully received events as a UTC string in YYYY-MM-DD HH:MM:SS format
120
     *     - batches_sent integer the number of event batches that have ever been sent to this webhook
121
     *     - events_sent integer the total number of events that have ever been sent to this webhook
122
     *     - last_error string if we've ever gotten an error trying to post to this webhook, the last error that we've seen
123
     */
124
    public function delete($id)
125
    {
126
        $_params = array("id" => $id);
127
        return $this->master->call('webhooks/delete', $_params);
128
    }
129
}
130