class Webhook extends BaseResource implements CreatableInterface

Webhook class.

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

Traits

WebhookProxyExtension trait.
DeletableTrait.
UpdatableTrait.

Properties

SystemProperties $sys from UpdatableTrait
Client $client from UpdatableTrait
protected string $name
protected string $url
protected string|null $httpBasicUsername
protected string|null $httpBasicPassword
protected string[] $topics
protected string[] $headers

Methods

initialize(string $type, array $sys = [])

Initialize system properties.

getSystemProperties()

{@inheritdoc}

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.

ResourceArray
getCalls(Query $query = null)

Returns a ResourceArray object containing WebhookCall resources.

getHealth()

Returns an WebhookHealth resource.

delete()

Deletes the current resource.

update()

Deletes the current resource.

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

Webhook constructor.

array
jsonSerialize()

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

string[]
getHeadersForCreation()

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

string[]
asUriParameters()

Returns an associate 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

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

in BaseResource at line 39
protected initialize(string $type, array $sys = [])

Initialize system properties.

Parameters

string $type The system type
array $sys

in BaseResource at line 48
getSystemProperties()

{@inheritdoc}

in BaseResource at line 56
getId()

{@inheritdoc}

in BaseResource at line 64
getType()

{@inheritdoc}

{@inheritdoc}

in UpdatableTrait at line 33
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 98
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 128
protected getSpaceId()

{@inheritdoc}

at line 120
protected getWebhookId()

{@inheritdoc}

in WebhookProxyExtension at line 53
WebhookCall getCall(string $callId)

Returns a WebhookCall resource.

Parameters

string $callId

Return Value

WebhookCall

See also

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

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

Returns a ResourceArray object containing WebhookCall resources.

Parameters

Query $query

Return Value

ResourceArray

See also

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

in WebhookProxyExtension at line 87
WebhookHealth getHealth()

Returns an WebhookHealth resource.

Return Value

WebhookHealth

See also

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

in DeletableTrait at line 29
delete()

Deletes the current resource.

in UpdatableTrait at line 38
update()

Deletes the current resource.

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

Webhook constructor.

Parameters

string $name
string $url
array $topics

at line 81
array jsonSerialize()

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

Return Value

array

at line 112
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 136
string[] asUriParameters()

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

Return Value

string[]

at line 147
string getName()

Return Value

string

at line 157
Webhook setName(string $name)

Parameters

string $name

Return Value

Webhook

at line 167
string getUrl()

Return Value

string

at line 177
Webhook setUrl(string $url)

Parameters

string $url

Return Value

Webhook

at line 187
string|null getHttpBasicUsername()

Return Value

string|null

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

Parameters

string $httpBasicUsername

Return Value

Webhook

at line 207
string|null getHttpBasicPassword()

Return Value

string|null

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

Parameters

string $httpBasicPassword

Return Value

Webhook

at line 227
string[] getHeaders()

Return Value

string[]

at line 239
string getHeader(string $key)

Parameters

string $key

Return Value

string

Exceptions

InvalidArgumentException

at line 256
bool hasHeader(string $key)

Parameters

string $key

Return Value

bool

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 301
Webhook removeHeader(string $key)

Parameters

string $key

Return Value

Webhook

Exceptions

InvalidArgumentException

at line 318
string[] getTopics()

Return Value

string[]

at line 328
Webhook addTopic(string $topic)

Parameters

string $topic

Return Value

Webhook

at line 341
Webhook setTopics(array $topics)

Parameters

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

Return Value

Webhook

at line 353
bool hasTopic(string $topic)

Parameters

string $topic

Return Value

bool

at line 365
Webhook removeTopic(string $topic)

Parameters

string $topic

Return Value

Webhook

Exceptions

InvalidArgumentException