class Webhook extends BaseResource implements Creatable, Updatable, Deletable

Webhook class.

This class represents a resource with type "WebhookDefinition" in Contentful.

Properties

protected SystemProperties $sys from BaseResource
protected BaseProxy $proxy from BaseResource
protected string $name
protected string $url
protected string|null $httpBasicUsername
protected string|null $httpBasicPassword
protected string[] $topics
protected string[] $headers

Methods

__construct(string $name, string $url, array $topics = [])

Webhook constructor.

getSystemProperties()

Returns the resource's system properties, defined in the object "sys" in Contentful's responses.

string|null
getId()

Shortcut for accessing the resource ID through its system properties.

Link
asLink()

Creates a Link representation of the current resource.

setProxy(BaseProxy $proxy)

Sets the current BaseProxy object instance.

asRequestBody()

{@inheritdoc}

__call(string $name, array $arguments)

Shortcut for forwarding methods to the current proxy, using the current object as argument.

array
jsonSerialize()

Returns an array to be used by "json_encode" to serialize objects of this class.

string
getName()

No description

setName(string $name)

No description

string
getUrl()

No description

setUrl(string $url)

No description

string|null
getHttpBasicUsername()

No description

setHttpBasicUsername(string $httpBasicUsername = null)

No description

string|null
getHttpBasicPassword()

No description

setHttpBasicPassword(string $httpBasicPassword = null)

No description

string[]
getHeaders()

No description

string
getHeader(string $key)

No description

bool
hasHeader(string $key)

No description

addHeader(string $key, string $value)

No description

setHeaders(array $headers)

No description

removeHeader(string $key)

No description

string[]
getTopics()

No description

addTopic(string $topic)

No description

setTopics(array $topics)

No description

bool
hasTopic(string $topic)

No description

removeTopic(string $topic)

No description

Details

at line 62
__construct(string $name, string $url, array $topics = [])

Webhook constructor.

Parameters

string $name
string $url
array $topics

in BaseResource at line 47
SystemProperties getSystemProperties()

Returns the resource's system properties, defined in the object "sys" in Contentful's responses.

Return Value

SystemProperties

in BaseResource at line 57
string|null getId()

Shortcut for accessing the resource ID through its system properties.

Return Value

string|null

Creates a Link representation of the current resource.

Return Value

Link

in BaseResource at line 79
BaseResource setProxy(BaseProxy $proxy)

Sets the current BaseProxy object instance.

This is done automatically when performing API calls, so it shouldn't be used manually.

Parameters

BaseProxy $proxy

Return Value

BaseResource

in BaseResource at line 89
asRequestBody()

{@inheritdoc}

in BaseResource at line 111
__call(string $name, array $arguments)

Shortcut for forwarding methods to the current proxy, using the current object as argument.

// Instead of
$client->asset->publish($asset);
// You can use
$asset->publish();

Parameters

string $name
array $arguments

at line 75
array jsonSerialize()

Returns an array to be used by "json_encode" to serialize objects of this class.

Return Value

array

at line 106
string getName()

Return Value

string

at line 116
Webhook setName(string $name)

Parameters

string $name

Return Value

Webhook

at line 126
string getUrl()

Return Value

string

at line 136
Webhook setUrl(string $url)

Parameters

string $url

Return Value

Webhook

at line 146
string|null getHttpBasicUsername()

Return Value

string|null

at line 156
Webhook setHttpBasicUsername(string $httpBasicUsername = null)

Parameters

string $httpBasicUsername

Return Value

Webhook

at line 166
string|null getHttpBasicPassword()

Return Value

string|null

at line 176
Webhook setHttpBasicPassword(string $httpBasicPassword = null)

Parameters

string $httpBasicPassword

Return Value

Webhook

at line 186
string[] getHeaders()

Return Value

string[]

at line 198
string getHeader(string $key)

Parameters

string $key

Return Value

string

Exceptions

InvalidArgumentException

at line 215
bool hasHeader(string $key)

Parameters

string $key

Return Value

bool

at line 226
Webhook addHeader(string $key, string $value)

Parameters

string $key
string $value

Return Value

Webhook

at line 238
Webhook setHeaders(array $headers)

Parameters

array $headers An array in the form 'X-Header-Name' => 'Header Value'

Return Value

Webhook

at line 260
Webhook removeHeader(string $key)

Parameters

string $key

Return Value

Webhook

Exceptions

InvalidArgumentException

at line 277
string[] getTopics()

Return Value

string[]

at line 287
Webhook addTopic(string $topic)

Parameters

string $topic

Return Value

Webhook

at line 300
Webhook setTopics(array $topics)

Parameters

array $topics A simple list of topics; array keys will be discarded

Return Value

Webhook

at line 312
bool hasTopic(string $topic)

Parameters

string $topic

Return Value

bool

at line 324
Webhook removeTopic(string $topic)

Parameters

string $topic

Return Value

Webhook

Exceptions

InvalidArgumentException