Repository navigation
Add ExcludedCustomer resource and exclude option on Customer.destroy (PIP-585) - #147
Open
ya-petrov-evgeniy wants to merge 2 commits into
Open
ya-petrov-evgeniy wants to merge 2 commits into
ya-petrov-evgeniy wants to merge 2 commits into
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
ya-petrov-evgeniy
marked this pull request as ready for review
November 25, 2026 08:25
tudorpavel
reviewed
Nov 25, 2026
| chartmogul.ExcludedCustomer.all(config, cursor='aabbcc', per_page=20) | ||
| # Removes the customer from the exclude list; the result has customer_uuid and | ||
| # status ('reimporting' or 'manual_reimport_required') | ||
| chartmogul.ExcludedCustomer.destroy(config, uuid='cus_5915ee5a-babd-406b-b8ce-d207133fb4cb') |
Contributor
There was a problem hiding this comment.
I guess we could use reinclude here too for consistency across SDK.
Author
There was a problem hiding this comment.
Done, renamed to reinclude and it now returns a separate ReincludedCustomer with only customer_uuid and status.
…type Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
tudorpavel
approved these changes
Nov 25, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
The ChartMogul API can now exclude customers from re-import and manage the exclude list (platform#33735, platform#33795, PIP-585):
DELETE /v1/customers/:uuidaccepts an optionalexcludeboolean that also adds the customer to the account's exclude list.GET /v1/excluded_customerslists excluded data source customers, newest first, with cursor pagination.DELETE /v1/excluded_customers/:uuidre-includes a customer and responds 202 withcustomer_uuidandstatus(reimportingormanual_reimport_required).Changes
Customer.destroy(config, uuid=..., exclude=True)sendsexclude=trueas a query param. Withoutexcludethe request is unchanged and still returnsNone.ExcludedCustomerresource:ExcludedCustomer.all(config, cursor=..., per_page=...)returnsExcludedCustomers(entries, has_more, cursor). Each entry hascustomer_uuid,data_source_uuid,external_id,name,emailandexcluded_at(parsed as a datetime).ExcludedCustomer.reinclude(config, uuid=...)returns aReincludedCustomerwith onlycustomer_uuidandstatus. List entries don't carrystatus.ReincludedCustomeroverrides_loadbecauseResource._loaddrops the body of a 202 response.Usage
Backwards compatibility
excludekwarg onCustomer.destroyExcludedCustomerandReincludedCustomerclassesTest plan
Customer.destroywithexclude=Truesends?exclude=true. This uses a case-sensitive mock so the bool-to-string conversion is checked.Customer.destroywithoutexcludesends no query string.ExcludedCustomer.allforwardscursor/per_pageand parses the entries pluscursor/has_more.ExcludedCustomer.allentries have nostatusattribute.ExcludedCustomer.reincludereturns aReincludedCustomerwithcustomer_uuid/statusfrom the 202 body.APIError.python -m unittest: 215 tests pass.flake8 ./chartmogulis clean.Customer.destroyoverride, removingexcludefrom_bool_query_params, removing the_loadoverride, parsing the re-include result asExcludedCustomer, puttingstatusback on list entries, droppingraise_for_status, always sendingexclude, and changing the path or schema each fail at least one new test.exclude=Trueand one without, pages throughExcludedCustomer.all(per_page=1)by cursor, and checks that only the excluded customer is listed, with all its fields. Re-including it withExcludedCustomer.reincludereturns aReincludedCustomerwithmanual_reimport_required(custom source), a second re-include raisesAPIError(404), and the customer is no longer listed.🤖 Generated with Claude Code