-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v4 API: Forms #76
v4 API: Forms #76
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! What are your thoughts on passing along existing vs. new to the API consumer? The API will return a 200 if the subscriber is already subscribed vs. a 201 if it is not.
This PR exposes the response object, allowing the consumer to inspect the HTTP status code, should they wish to determine whether a subscriber is already subscribed vs. created: $result = $api->add_subscriber_to_form(12345, 'joe.bloggs@convertkit.com');
$code = $api->getResponseInterface()->getStatusCode(); // 200 OK if e.g. a subscriber already added to the specified form, 201 Created if the subscriber added to the specified form for the first time. |
Summary
Adds support for endpoints in the forms section of the v4 API.
Testing
testGetFormSubscriptionsWithBouncedSubscriberState
: Test that get_form_subscriptions() returns the expected data when a valid Form ID is specified and the subscription status is cancelled.testGetFormSubscriptionsWithAddedAfterParam
: Test that get_form_subscriptions() returns the expected data when a valid Form ID is specified and the added_after parameter is used.testGetFormSubscriptionsWithAddedBeforeParam
: Test that get_form_subscriptions() returns the expected data when a valid Form ID is specified and the added_before parameter is used.testGetFormSubscriptionsWithCreatedAfterParam
: Test that get_form_subscriptions() returns the expected data when a valid Form ID is specified and the created_after parameter is used.testGetFormSubscriptionsWithCreatedBeforeParam
: Test that get_form_subscriptions() returns the expected data when a valid Form ID is specified and the created_before parameter is used.testGetFormSubscriptionsPagination
: Test that get_form_subscriptions() returns the expected data when a valid Form ID is specified and pagination parameters and per_page limits are specified.testGetFormSubscriptionsWithInvalidFormID
: Test that get_form_subscriptions() throws a ClientException when an invalid Form ID is specified.testGetFormSubscriptionsWithInvalidSubscriberState
: Test that get_form_subscriptions() throws a ClientException when an invalid subscriber state is specified.testGetFormSubscriptionsWithInvalidPagination
: Test that get_form_subscriptions() throws a ClientException when invalid pagination parameters are specified.testAddSubscriberToFormByID
: Test that add_subscriber_to_form_by_subscriber_id() returns the expected data.testAddSubscriberToFormByIDWithInvalidFormID
: Test that add_subscriber_to_form_by_subscriber_id() throws a ClientException when an invalid form ID is specified.testAddSubscriberToFormByIDWithInvalidSubscriberID
: Test that add_subscriber_to_form_by_subscriber_id() throws a ClientException when an invalid email address is specified.Removed Tests:
testAddSubscriberToFormWithFirstName
testAddSubscriberToFormWithCustomFields
testAddSubscriberToFormWithTagID
v4 API has no concept of adding a new subscriber to a form with data; a separate PR will be added to add support for the new
Create a subscriber
endpoint (https://developers.convertkit.com/v4.html#create-a-subscriber), which supports this.Checklist