Package com.contentful.java.cma.model
Class CMAWebhook
- java.lang.Object
-
- com.contentful.java.cma.model.CMAResource
-
- com.contentful.java.cma.model.CMAWebhook
-
public class CMAWebhook extends CMAResource
Represents one webhook definition.A valid webhook needs to at least have called
setName(String),setUrl(String),addTopic(CMAWebhookTopic).
-
-
Constructor Summary
Constructors Constructor Description CMAWebhook()Create a webhoook, setting up the system attribute for it.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CMAWebhookaddHeader(java.lang.String key, java.lang.String value)Adds a custom http header to the call done by this webhook.CMAWebhookaddTopic(CMAWebhookTopic topic)Add a topic this webhook should be triggered on.java.util.List<CMAWebhookHeader>getHeaders()java.lang.StringgetName()java.lang.StringgetPassword()java.util.List<CMAWebhookTopic>getTopics()CMAWebhookTransformationgetTransformation()java.lang.StringgetUrl()java.lang.StringgetUser()CMAWebhooksetBasicAuthorization(java.lang.String user, java.lang.String password)Set authorization parameter for basic HTTP authorization on the url to be called by this webhook.CMAWebhooksetId(java.lang.String id)Convenience: Update the id of this entry without going throughCMAResource.getSystem().CMAWebhooksetName(java.lang.String name)Set the name of this webhook.CMAWebhooksetSpaceId(java.lang.String spaceId)Convenience: Update the space id of this entry without going throughCMAResource.getSystem().CMAWebhooksetSystem(CMASystem system)Sets the system field.CMAWebhooksetTransformation(CMAWebhookTransformation transformation)Set the transformation of this webhookCMAWebhooksetUrl(java.lang.String url)Sets the url to be called when this webhook is triggered.CMAWebhooksetVersion(java.lang.Integer version)Convenience: Update the version of this entry without going throughCMAResource.getSystem().java.lang.StringtoString()-
Methods inherited from class com.contentful.java.cma.model.CMAResource
getEnvironmentId, getId, getSpaceId, getSystem, getVersion, getVisibility, isArchived, isPublished, setEnvironmentId, setVisibility
-
-
-
-
Method Detail
-
setSystem
public CMAWebhook setSystem(CMASystem system)
Sets the system field.- Overrides:
setSystemin classCMAResource- Parameters:
system- sets the system property.- Returns:
- this, as casted to a resource, for the ease of chaining.
-
setId
public CMAWebhook setId(java.lang.String id)
Convenience: Update the id of this entry without going throughCMAResource.getSystem().- Overrides:
setIdin classCMAResource- Parameters:
id- to be set.- Returns:
- the calling instance for chaining.
-
setVersion
public CMAWebhook setVersion(java.lang.Integer version)
Convenience: Update the version of this entry without going throughCMAResource.getSystem().- Overrides:
setVersionin classCMAResource- Parameters:
version- to be set.- Returns:
- the calling instance for chaining.
-
setSpaceId
public CMAWebhook setSpaceId(java.lang.String spaceId)
Convenience: Update the space id of this entry without going throughCMAResource.getSystem().- Overrides:
setSpaceIdin classCMAResource- Parameters:
spaceId- to be set.- Returns:
- the calling instance for chaining.
-
addTopic
public CMAWebhook addTopic(CMAWebhookTopic topic)
Add a topic this webhook should be triggered on.- Parameters:
topic- a valid enum value for the trigger reason.- Returns:
- this webhook for chaining
-
addHeader
public CMAWebhook addHeader(java.lang.String key, java.lang.String value)
Adds a custom http header to the call done by this webhook.- Parameters:
key- HTTP header key to be used (aka 'X-My-Header-Name')value- HTTP header value to be used (aka 'this-is-my-name')- Returns:
- this webhook for chaining.
-
setBasicAuthorization
public CMAWebhook setBasicAuthorization(java.lang.String user, java.lang.String password)
Set authorization parameter for basic HTTP authorization on the url to be called by this webhook.- Parameters:
user- username to be usedpassword- password to be used (cannot be retrieved, only updated!)- Returns:
- this webhook for chaining.
-
getName
public java.lang.String getName()
- Returns:
- the name of this webhook
-
setName
public CMAWebhook setName(java.lang.String name)
Set the name of this webhook.- Parameters:
name- to identify this webhook- Returns:
- this webhook for chaining
-
getUrl
public java.lang.String getUrl()
- Returns:
- Url to the server to be called, if this webhook is to be triggered
-
setUrl
public CMAWebhook setUrl(java.lang.String url)
Sets the url to be called when this webhook is triggered.- Parameters:
url- complete, existing url to be used- Returns:
- this webhook for chaining
-
getTopics
public java.util.List<CMAWebhookTopic> getTopics()
- Returns:
- A copy of the topics this webhook is interested in.
-
getHeaders
public java.util.List<CMAWebhookHeader> getHeaders()
- Returns:
- A copy of the custom headers this webhook uses when triggered.
-
getTransformation
public CMAWebhookTransformation getTransformation()
- Returns:
- the transformation.
-
setTransformation
public CMAWebhook setTransformation(CMAWebhookTransformation transformation)
Set the transformation of this webhook- Parameters:
transformation- transformation property.- Returns:
- this webhook for chaining.
-
getUser
public java.lang.String getUser()
- Returns:
- the http basic auth user set.
- See Also:
setBasicAuthorization(String, String)
-
getPassword
public java.lang.String getPassword()
- Returns:
- the http basic auth password set (only valid while creating the hook on Contentful).
- See Also:
setBasicAuthorization(String, String)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classCMAResource- Returns:
- a human readable string, representing the object.
-
-