-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add contact properties module #70
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
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.
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")); |
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.
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<String> response = httpClient.perform("/contact-properties", super.apiKey, HttpMethod.POST, payload, MediaType.get("application/json"));
+
+ if (!response.isSuccessful()) {
</file context>
| CreateContactPropertyResponseSuccess expected = ContactPropertiesUtil.createContactPropertyResponseSuccess(); | ||
| CreateContactPropertyOptions param = ContactPropertiesUtil.createContactPropertyRequest(); | ||
|
|
||
| when(contactProperties.create(param)) |
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.
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>
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.
Written for commit e7cf6dd. Summary will update automatically on new commits.