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

string
getId()

{@inheritdoc}

string
getType()

{@inheritdoc}

Link
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.

ResourceArray
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.

array
jsonSerialize()

{@inheritdoc}

array
getHeadersForCreation()

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

array
asUriParameters()

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

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

array
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

array
getTopics()

No description

addTopic(string $topic)

No description

setTopics(array $topics)

No description

bool
hasTopic(string $topic)

No description

removeTopic(string $topic)

No description

array
getFilters()

No description

setFilters(array $filters)

No description

array
getTransformation()

No description

setTransformation(array $transformation)

No description

Details

in BaseResource at line 37
string getId()

{@inheritdoc}

Return Value

string

in BaseResource at line 45
string getType()

{@inheritdoc}

Return Value

string

{@inheritdoc}

Return Value

Link

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 79
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 54
WebhookCall getCall(string $callId)

in WebhookProxyExtension at line 72
ResourceArray getCalls(Query $query = \null)

Returns a ResourceArray object containing WebhookCall resources.

in DeletableTrait at line 28
delete()

Deletes the current resource.

in UpdatableTrait at line 40
update()

Updates the current resource.

at line 96
Webhook getSystemProperties()

{@inheritdoc}

Return Value

Webhook

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

Webhook constructor.

Parameters

string $name
string $url
array $topics

at line 104
array jsonSerialize()

{@inheritdoc}

Return Value

array

at line 143
array 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

array

at line 167
array 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

array

at line 178
string getName()

Return Value

string

at line 188
Webhook setName(string $name)

Parameters

string $name

Return Value

Webhook

at line 198
string getUrl()

Return Value

string

at line 208
Webhook setUrl(string $url)

Parameters

string $url

Return Value

Webhook

at line 218
string|null getHttpBasicUsername()

Return Value

string|null

at line 228
Webhook setHttpBasicUsername(string $httpBasicUsername = \null)

Parameters

string $httpBasicUsername

Return Value

Webhook

at line 238
string|null getHttpBasicPassword()

Return Value

string|null

at line 248
Webhook setHttpBasicPassword(string $httpBasicPassword = \null)

Parameters

string $httpBasicPassword

Return Value

Webhook

at line 258
array getHeaders()

Return Value

array

at line 270
string getHeader(string $key)

Parameters

string $key

Return Value

string

Exceptions

InvalidArgumentException

at line 287
bool hasHeader(string $key)

Parameters

string $key

Return Value

bool

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

Parameters

string $key
string $value

Return Value

Webhook

at line 310
Webhook setHeaders(array $headers)

Parameters

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

Return Value

Webhook

at line 332
Webhook removeHeader(string $key)

Parameters

string $key

Return Value

Webhook

Exceptions

InvalidArgumentException

at line 349
array getTopics()

Return Value

array

at line 359
Webhook addTopic(string $topic)

Parameters

string $topic

Return Value

Webhook

at line 372
Webhook setTopics(array $topics)

Parameters

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

Return Value

Webhook

at line 384
bool hasTopic(string $topic)

Parameters

string $topic

Return Value

bool

at line 396
Webhook removeTopic(string $topic)

Parameters

string $topic

Return Value

Webhook

Exceptions

InvalidArgumentException

at line 415
array getFilters()

Return Value

array

at line 425
Webhook setFilters(array $filters)

Parameters

array $filters

Return Value

Webhook

at line 435
array getTransformation()

Return Value

array

at line 445
Webhook setTransformation(array $transformation)

Parameters

array $transformation

Return Value

Webhook