class Webhook extends BaseResource implements CreatableInterface

Webhook class.

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

Traits

DeletableTrait.
UpdatableTrait.
WebhookProxyExtension trait.

Properties

protected Webhook $sys
Client $client from WebhookProxyExtension
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.

delete()

Deletes the current resource.

update()

Updates the current resource.

getSystemProperties()

{@inheritdoc}

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.

__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

in DeletableTrait at line 28
delete()

Deletes the current resource.

in UpdatableTrait at line 40
update()

Updates the current resource.

at line 94
getSystemProperties()

{@inheritdoc}

at line 157
protected getSpaceId()

{@inheritdoc}

at line 149
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

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

Webhook constructor.

Parameters

string $name
string $url
array $topics

at line 102
jsonSerialize()

{@inheritdoc}

at line 141
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 165
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 173
getName()

at line 181
Webhook setName(string $name)

Parameters

string $name

Return Value

Webhook

at line 188
getUrl()

at line 196
Webhook setUrl(string $url)

Parameters

string $url

Return Value

Webhook

at line 206
string|null getHttpBasicUsername()

Return Value

string|null

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

Parameters

string $httpBasicUsername

Return Value

Webhook

at line 224
string|null getHttpBasicPassword()

Return Value

string|null

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

Parameters

string $httpBasicPassword

Return Value

Webhook

at line 242
string[] getHeaders()

Return Value

string[]

at line 250
getHeader(string $key)

Parameters

string $key

Exceptions

InvalidArgumentException

at line 259
hasHeader(string $key)

Parameters

string $key

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

Parameters

string $key
string $value

Return Value

Webhook

at line 279
Webhook setHeaders(array $headers)

Parameters

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

Return Value

Webhook

at line 297
Webhook removeHeader(string $key)

Parameters

string $key

Return Value

Webhook

Exceptions

InvalidArgumentException

at line 311
string[] getTopics()

Return Value

string[]

at line 319
Webhook addTopic(string $topic)

Parameters

string $topic

Return Value

Webhook

at line 332
Webhook setTopics(array $topics)

Parameters

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

Return Value

Webhook

at line 339
hasTopic(string $topic)

Parameters

string $topic

at line 349
Webhook removeTopic(string $topic)

Parameters

string $topic

Return Value

Webhook

Exceptions

InvalidArgumentException

at line 365
FilterInterface[] getFilters()

Return Value

FilterInterface[]

at line 375
Webhook setFilters(array $filters)

Parameters

array $filters

Return Value

Webhook

at line 382
getTransformation()

at line 390
Webhook setTransformation(array $transformation)

Parameters

array $transformation

Return Value

Webhook