Search in sources :

Example 1 with AddWebhookTagRequest

use of com.formkiq.stacks.client.requests.AddWebhookTagRequest in project formkiq-core by formkiq.

the class WebhookTagsRequestTest method testPublicWebhooks01.

/**
 * Test POST /webhooks/{webhookId}/tags.
 *
 * @throws Exception Exception
 */
@Test(timeout = TEST_TIMEOUT)
public void testPublicWebhooks01() throws Exception {
    for (FormKiqClientV1 client : getFormKiqClients()) {
        // given
        String id = client.addWebhook(new AddWebhookRequest().name("paypal")).id();
        AddWebhookTagRequest req = new AddWebhookTagRequest().tagKey("category").tagValue("person").webhookId(id);
        // when
        boolean result = client.addWebhookTag(req);
        // then
        assertTrue(result);
        // given
        GetWebhookTagsRequest get = new GetWebhookTagsRequest().webhookId(id);
        // when
        WebhookTags tags = client.getWebhookTags(get);
        // then
        assertEquals(1, tags.tags().size());
        WebhookTag tag = tags.tags().get(0);
        assertEquals("category", tag.key());
        assertNotNull(tag.insertedDate());
        assertEquals("USERDEFINED", tag.type());
        assertNotNull(tag.userId());
        assertEquals("person", tag.value());
        assertEquals(id, tag.webhookId());
    }
}
Also used : WebhookTags(com.formkiq.stacks.client.models.WebhookTags) GetWebhookTagsRequest(com.formkiq.stacks.client.requests.GetWebhookTagsRequest) WebhookTag(com.formkiq.stacks.client.models.WebhookTag) AddWebhookTagRequest(com.formkiq.stacks.client.requests.AddWebhookTagRequest) FormKiqClientV1(com.formkiq.stacks.client.FormKiqClientV1) AddWebhookRequest(com.formkiq.stacks.client.requests.AddWebhookRequest) Test(org.junit.Test)

Aggregations

FormKiqClientV1 (com.formkiq.stacks.client.FormKiqClientV1)1 WebhookTag (com.formkiq.stacks.client.models.WebhookTag)1 WebhookTags (com.formkiq.stacks.client.models.WebhookTags)1 AddWebhookRequest (com.formkiq.stacks.client.requests.AddWebhookRequest)1 AddWebhookTagRequest (com.formkiq.stacks.client.requests.AddWebhookTagRequest)1 GetWebhookTagsRequest (com.formkiq.stacks.client.requests.GetWebhookTagsRequest)1 Test (org.junit.Test)1