Skip to content

Conversation

@kewynakshlley
Copy link
Collaborator

@kewynakshlley kewynakshlley commented Oct 30, 2025

Summary by cubic

Adds a ContactProperties module to the SDK, enabling create, list, get, update, and delete operations for contact properties. Exposes a new Resend.contactProperties() client for easy access.

  • New Features
    • New client factory: Resend.contactProperties().
    • CRUD methods: create(), list(), get(id), update(options), remove(id).
    • Request/response models with JSON mapping (builder options for create/update).
    • Input validation for required IDs and ResendException on HTTP errors.

Written for commit e7cf6dd. Summary will update automatically on new commits.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 12 files

Prompt for AI agents (all 2 issues)

Understand the root cause of the following 2 issues and fix them.


<file name="src/main/java/com/resend/services/contactproperties/ContactProperties.java">

<violation number="1" location="src/main/java/com/resend/services/contactproperties/ContactProperties.java:33">
Rule violated: **API Key Permission Check SDK Methods**

Please double-check that the production Resend API keys already include the scopes needed for the new /contact-properties create/list/get/update/remove calls; otherwise these SDK methods will fail immediately once deployed, violating the API Key Permission Check SDK Methods guideline.</violation>
</file>

<file name="src/test/java/com/resend/services/contactproperties/ContactPropertiesTest.java">

<violation number="1" location="src/test/java/com/resend/services/contactproperties/ContactPropertiesTest.java:31">
These tests stub and call a mock of ContactProperties, so none of the real service logic (HTTP call, validation, error handling) is executed. The assertions only confirm Mockito returns the stubbed values, giving a false sense of coverage. Replace the mock with a real ContactProperties instance (with appropriately mocked lower-level dependencies) so the tests exercise the actual implementation.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

*/
public CreateContactPropertyResponseSuccess create(CreateContactPropertyOptions createContactPropertyOptions) throws ResendException {
String payload = super.resendMapper.writeValue(createContactPropertyOptions);
AbstractHttpResponse<String> response = httpClient.perform("/contact-properties", super.apiKey, HttpMethod.POST, payload, MediaType.get("application/json"));
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Oct 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rule violated: API Key Permission Check SDK Methods

Please double-check that the production Resend API keys already include the scopes needed for the new /contact-properties create/list/get/update/remove calls; otherwise these SDK methods will fail immediately once deployed, violating the API Key Permission Check SDK Methods guideline.

Prompt for AI agents
Address the following comment on src/main/java/com/resend/services/contactproperties/ContactProperties.java at line 33:

<comment>Please double-check that the production Resend API keys already include the scopes needed for the new /contact-properties create/list/get/update/remove calls; otherwise these SDK methods will fail immediately once deployed, violating the API Key Permission Check SDK Methods guideline.</comment>

<file context>
@@ -0,0 +1,130 @@
+     */
+    public CreateContactPropertyResponseSuccess create(CreateContactPropertyOptions createContactPropertyOptions) throws ResendException {
+        String payload = super.resendMapper.writeValue(createContactPropertyOptions);
+        AbstractHttpResponse&lt;String&gt; response = httpClient.perform(&quot;/contact-properties&quot;, super.apiKey, HttpMethod.POST, payload, MediaType.get(&quot;application/json&quot;));
+
+        if (!response.isSuccessful()) {
</file context>
Fix with Cubic

CreateContactPropertyResponseSuccess expected = ContactPropertiesUtil.createContactPropertyResponseSuccess();
CreateContactPropertyOptions param = ContactPropertiesUtil.createContactPropertyRequest();

when(contactProperties.create(param))
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Oct 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests stub and call a mock of ContactProperties, so none of the real service logic (HTTP call, validation, error handling) is executed. The assertions only confirm Mockito returns the stubbed values, giving a false sense of coverage. Replace the mock with a real ContactProperties instance (with appropriately mocked lower-level dependencies) so the tests exercise the actual implementation.

Prompt for AI agents
Address the following comment on src/test/java/com/resend/services/contactproperties/ContactPropertiesTest.java at line 31:

<comment>These tests stub and call a mock of ContactProperties, so none of the real service logic (HTTP call, validation, error handling) is executed. The assertions only confirm Mockito returns the stubbed values, giving a false sense of coverage. Replace the mock with a real ContactProperties instance (with appropriately mocked lower-level dependencies) so the tests exercise the actual implementation.</comment>

<file context>
@@ -0,0 +1,96 @@
+        CreateContactPropertyResponseSuccess expected = ContactPropertiesUtil.createContactPropertyResponseSuccess();
+        CreateContactPropertyOptions param = ContactPropertiesUtil.createContactPropertyRequest();
+
+        when(contactProperties.create(param))
+                .thenReturn(expected);
+
</file context>
Fix with Cubic

@kewynakshlley kewynakshlley merged commit 4ba086c into main Oct 30, 2025
4 checks passed
@kewynakshlley kewynakshlley deleted the feat/contact-properties branch October 30, 2025 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants