class Webhook extends BaseResource implements CreatableInterface

Webhook class.

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

Traits

WebhookProxyExtension trait.
DeletableTrait.
UpdatableTrait.

Properties

protected Webhook $sys
Client $client from UpdatableTrait
protected string $name
protected string $url
protected string|null $httpBasicUsername
protected string|null $httpBasicPassword
protected string[] $topics
protected string[] $headers
protected FilterInterface[] $filters
protected array $transformation

Methods

getId()

{@inheritdoc}

getType()

{@inheritdoc}

asLink()

{@inheritdoc}

mixed
asRequestBody()

Returns the resource in the form of request body.

setClient(Client $client)

Sets the current Client object instance.

getSpaceId()

{@inheritdoc}

getWebhookId()

{@inheritdoc}

getCall(string $callId)

Returns a WebhookCall resource.

getCalls(Query $query = null)

Returns a ResourceArray object containing WebhookCall resources.

getHealth()

Returns an WebhookHealth resource.

delete()

Deletes the current resource.

update()

Updates the current resource.

getSystemProperties()

{@inheritdoc}

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

Webhook constructor.

jsonSerialize()

{@inheritdoc}

string[]
getHeadersForCreation()

Returns an array of headers that the current resource needs to sent for being created.

string[]
asUriParameters()

Returns an associative array where keys are the name of the fragments in a URI, and the values are the corresponding IDs.

getName()

No description

setName(string $name)

No description

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

getHeader(string $key)

No description

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

hasTopic(string $topic)

No description

removeTopic(string $topic)

No description

getFilters()

No description

setFilters(array $filters)

No description

getTransformation()

No description

setTransformation(array $transformation)

No description

Details

in BaseResource at line 37
getId()

{@inheritdoc}

in BaseResource at line 45
getType()

{@inheritdoc}

{@inheritdoc}

in UpdatableTrait at line 35
abstract mixed asRequestBody()

Returns the resource in the form of request body.

This can differ from regular serialization, as some fields may not be present in the request payload.

Return Value

mixed

in BaseResource at line 77
BaseResource setClient(Client $client)

Sets the current Client object instance.

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

Parameters

Client $client

Return Value

BaseResource

at line 159
protected getSpaceId()

{@inheritdoc}

at line 151
protected getWebhookId()

{@inheritdoc}

in WebhookProxyExtension at line 50
getCall(string $callId)

Returns a WebhookCall resource.

Parameters

string $callId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/webhook-calls/webhook-call-details

in WebhookProxyExtension at line 64
getCalls(Query $query = null)

Returns a ResourceArray object containing WebhookCall resources.

Parameters

Query $query

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/webhook-calls/webhook-call-overview

in WebhookProxyExtension at line 78
getHealth()

Returns an WebhookHealth resource.

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/webhook-calls/webhook-health

in DeletableTrait at line 28
delete()

Deletes the current resource.

in UpdatableTrait at line 40
update()

Updates the current resource.

at line 96
getSystemProperties()

{@inheritdoc}

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

Webhook constructor.

Parameters

string $name
string $url
array $topics

at line 104
jsonSerialize()

{@inheritdoc}

at line 143
string[] getHeadersForCreation()

Returns an array of headers that the current resource needs to sent for being created.

This method is supposed to be overridden if necessary.

Return Value

string[]

at line 167
string[] asUriParameters()

Returns an associative array where keys are the name of the fragments in a URI, and the values are the corresponding IDs.

Return Value

string[]

at line 175
getName()

at line 183
Webhook setName(string $name)

Parameters

string $name

Return Value

Webhook

at line 190
getUrl()

at line 198
Webhook setUrl(string $url)

Parameters

string $url

Return Value

Webhook

at line 208
string|null getHttpBasicUsername()

Return Value

string|null

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

Parameters

string $httpBasicUsername

Return Value

Webhook

at line 226
string|null getHttpBasicPassword()

Return Value

string|null

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

Parameters

string $httpBasicPassword

Return Value

Webhook

at line 244
string[] getHeaders()

Return Value

string[]

at line 252
getHeader(string $key)

Parameters

string $key

Exceptions

InvalidArgumentException

at line 261
hasHeader(string $key)

Parameters

string $key

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

Parameters

string $key
string $value

Return Value

Webhook

at line 281
Webhook setHeaders(array $headers)

Parameters

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

Return Value

Webhook

at line 299
Webhook removeHeader(string $key)

Parameters

string $key

Return Value

Webhook

Exceptions

InvalidArgumentException

at line 313
string[] getTopics()

Return Value

string[]

at line 321
Webhook addTopic(string $topic)

Parameters

string $topic

Return Value

Webhook

at line 334
Webhook setTopics(array $topics)

Parameters

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

Return Value

Webhook

at line 341
hasTopic(string $topic)

Parameters

string $topic

at line 351
Webhook removeTopic(string $topic)

Parameters

string $topic

Return Value

Webhook

Exceptions

InvalidArgumentException

at line 367
FilterInterface[] getFilters()

Return Value

FilterInterface[]

at line 377
Webhook setFilters(array $filters)

Parameters

array $filters

Return Value

Webhook

at line 384
getTransformation()

at line 392
Webhook setTransformation(array $transformation)

Parameters

array $transformation

Return Value

Webhook