Skip to content

Modernize the SDK: Lists, List items, Events, privacy requests and webhook verification - #161

Closed
bartes wants to merge 7 commits into
developfrom
feat/add-lists-events-privacy-webhook-apis
Closed

Modernize the SDK: Lists, List items, Events, privacy requests and webhook verification#161
bartes wants to merge 7 commits into
developfrom
feat/add-lists-events-privacy-webhook-apis

Conversation

@bartes

@bartes bartes commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Modernizes the SDK around the current Castle API surface while keeping the previous endpoints available for backward compatibility.

Added (modern API)

  • ListscreateList, getAllLists, getList, queryLists, updateList, deleteList.
  • List itemscreateListItem, createListItemsBatch, getListItem, queryListItems, countListItems, updateListItem, archiveListItem, unarchiveListItem.
  • PrivacyrequestUserData (POST /v1/privacy/users), deleteUserData (DELETE /v1/privacy/users).
  • EventseventsSchema, queryEvents, groupEvents.
  • WebhooksCastle#verifyWebhookSignature, verifying the X-Castle-Signature header against the raw request body using a base64-encoded HMAC-SHA256 of the body and a constant-time comparison. Overloads accept either the signature string or an HttpServletRequest.

New endpoints are thin wrappers over the existing generic request layer and return CastleResponse, mirroring risk / filter / log.

Supported APIs matrix

Modern API (recommended)

Capability Methods Since
Scoring risk, filter, log 2.0.0
Generic requests get, post, put, delete 2.0.0
Lists createList, getAllLists, getList, queryLists, updateList, deleteList 2.2.0
List items createListItem, createListItemsBatch, getListItem, queryListItems, countListItems, updateListItem, archiveListItem, unarchiveListItem 2.2.0
Privacy requestUserData, deleteUserData 2.2.0
Events eventsSchema, queryEvents, groupEvents 2.2.0
Webhooks verifyWebhookSignature 2.2.0
Secure mode secureUserID 1.x

Previous API (deprecated, still supported)

Capability Methods Status
Authenticate authenticate, authenticateAsync Deprecated — use risk / filter
Track track Deprecated — use log
Devices approve, report, userDevices, device Deprecated
Impersonation impersonateStart, impersonateEnd Deprecated
Privacy (by id) removeUser Deprecated — use requestUserData / deleteUserData

Documents the modern and previous surface in the README and bumps the version to 2.2.0.

bartes added 2 commits June 10, 2026 23:25
…on APIs

Introduce the Lists API (createList, getAllLists, getList, queryLists,
updateList, deleteList) and the List items API (createListItem,
createListItemsBatch, getListItem, queryListItems, countListItems,
updateListItem, archiveListItem, unarchiveListItem) on CastleApi.

Add requestUserData for privacy data requests and the Events API
(eventsSchema, queryEvents, groupEvents).

Add Castle#verifyWebhookSignature for verifying the X-Castle-Signature
header against the raw request body using HMAC-SHA256.

Bump version to 2.2.0.
Add a Supported APIs section to the README listing the modern API surface
(scoring, generic requests, lists, list items, privacy, events, webhooks)
alongside the previous, deprecated-but-supported endpoints, and bump the
quickstart dependency snippet to 2.2.0.
@bartes bartes changed the title Add Lists, List items, Events, privacy request and webhook verification APIs Jun 10, 2026
@bartes
bartes changed the base branch from master to develop June 10, 2026 23:27
bartes added 5 commits June 11, 2026 17:20
Adds CastleApi#deleteUserData(payload) issuing DELETE /v1/privacy/users,
alongside the existing requestUserData. Documents it in the README and
CHANGELOG and covers it with an HTTP test.
Change archiveListItem to issue DELETE /v1/lists/{listId}/items/{itemId}/archive
instead of PUT, and update the HTTP test accordingly.
Replace the reflective Field.modifiers hack in SdkMockUtil by making the
internal restApiFactory field non-final, build the separate-classloader test
runner classpath from java.class.path instead of casting the system class
loader to URLClassLoader, and open java.base packages to the test runtime on
JDK 9+ so the environment-variable rule keeps working.
Run the test suite on Temurin 8, 11 and 17 on every push and pull request,
and pin Java 17 for local development via .tool-versions.
Drop the Authenticate (authenticate/authenticateAsync), Track (track),
device (approve/report/userDevices/device), impersonation
(impersonateStart/impersonateEnd) and removeUser endpoints, along with the
authenticate failover strategy configuration and the doNotTrack option, leaving
the modern surface: risk/filter/log, generic requests, Lists, List items,
Privacy (requestUserData/deleteUserData), Events, webhook verification and
secureUserID. Bump the version to 3.0.0.
@bartes bartes closed this Jun 11, 2026
@bartes
bartes deleted the feat/add-lists-events-privacy-webhook-apis branch June 11, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant