Class CMAWebhook

    • Constructor Detail

      • CMAWebhook

        public CMAWebhook()
        Create a webhoook, setting up the system attribute for it.
    • Method Detail

      • setSystem

        public CMAWebhook setSystem​(CMASystem system)
        Sets the system field.
        Overrides:
        setSystem in class CMAResource
        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 through CMAResource.getSystem().
        Overrides:
        setId in class CMAResource
        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 through CMAResource.getSystem().
        Overrides:
        setVersion in class CMAResource
        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 through CMAResource.getSystem().
        Overrides:
        setSpaceId in class CMAResource
        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 used
        password - 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.
      • setTransformation

        public CMAWebhook setTransformation​(CMAWebhookTransformation transformation)
        Set the transformation of this webhook
        Parameters:
        transformation - transformation property.
        Returns:
        this webhook for chaining.
      • 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:
        toString in class CMAResource
        Returns:
        a human readable string, representing the object.