Repository navigation
feat(receiving): filter listed received emails by recipient and date - #1202
Open
isabellaaquino wants to merge 1 commit into
Open
isabellaaquino wants to merge 1 commit into
isabellaaquino wants to merge 1 commit into
Conversation
commit: |
Contributor
There was a problem hiding this comment.
2 issues found across 3 files
Confidence score: 4/5
- In
list-receiving-emails.interface.ts, an emptytoarray can be serialized as a bareto=parameter. Skip it inreceiving.listor document thattomust be non-empty. - In
receiving.ts, callers may assumeto,startDate, andendDateare applied even when the team lacksapi-filtering. Document this requirement in the options’ JSDoc.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/emails/receiving/interfaces/list-receiving-emails.interface.ts">
<violation number="1" location="src/emails/receiving/interfaces/list-receiving-emails.interface.ts:7">
P2: An empty `to` array is serialized as a bare `to=` parameter instead of being omitted. Either skip the param when the array is empty in `receiving.list`, or document that `to` must be non-empty.</violation>
</file>
<file name="src/emails/receiving/receiving.ts">
<violation number="1" location="src/emails/receiving/receiving.ts:59">
P2: For teams without `api-filtering`, the API does not apply `to`, `startDate`, or `endDate`, and the SDK gives no signal. Document this requirement in the JSDoc for these three options so callers do not assume the filters work.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
| export type ListReceivingEmailsOptions = PaginationOptions; | ||
| export type ListReceivingEmailsOptions = PaginationOptions & { | ||
| /** Only return emails received by one of these addresses (exact, case-sensitive match, up to 20). */ | ||
| to?: string[]; |
Contributor
There was a problem hiding this comment.
P2: An empty to array is serialized as a bare to= parameter instead of being omitted. Either skip the param when the array is empty in receiving.list, or document that to must be non-empty.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At src/emails/receiving/interfaces/list-receiving-emails.interface.ts, line 7:
<comment>An empty `to` array is serialized as a bare `to=` parameter instead of being omitted. Either skip the param when the array is empty in `receiving.list`, or document that `to` must be non-empty.</comment>
<file context>
@@ -2,7 +2,14 @@ import type { PaginationOptions } from '../../../common/interfaces';
-export type ListReceivingEmailsOptions = PaginationOptions;
+export type ListReceivingEmailsOptions = PaginationOptions & {
+ /** Only return emails received by one of these addresses (exact, case-sensitive match, up to 20). */
+ to?: string[];
+ /** Inclusive lower bound on `created_at`. ISO 8601 date or datetime, read as UTC without an offset. */
+ startDate?: string;
</file context>
| requestOptions: RequestOptions = {}, | ||
| ): Promise<ListReceivingEmailsResponse> { | ||
| const url = buildPaginationUrl('/emails/receiving', options); | ||
| const { to, startDate, endDate, limit } = options; |
Contributor
There was a problem hiding this comment.
P2: For teams without api-filtering, the API does not apply to, startDate, or endDate, and the SDK gives no signal. Document this requirement in the JSDoc for these three options so callers do not assume the filters work.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At src/emails/receiving/receiving.ts, line 59:
<comment>For teams without `api-filtering`, the API does not apply `to`, `startDate`, or `endDate`, and the SDK gives no signal. Document this requirement in the JSDoc for these three options so callers do not assume the filters work.</comment>
<file context>
@@ -56,7 +56,15 @@ export class Receiving {
requestOptions: RequestOptions = {},
): Promise<ListReceivingEmailsResponse> {
- const url = buildPaginationUrl('/emails/receiving', options);
+ const { to, startDate, endDate, limit } = options;
+ const url = buildInboxCursorUrl('/emails/receiving', {
+ to,
</file context>
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.
Adds the
to,startDateandendDatefilters fromGET /emails/receivingtoresend.emails.receiving.list(), so users can list the emails an address received without going through threads.inboxes.threads.search(to: string[], camelCase dates), and the URL is built with the samebuildInboxCursorUrlhelper, which joinstointo one comma-separated param as the API expects (repeatingtoreturns a 422).limit/after/before) is unchanged.API: resend/resend-monorepo#13763 (filters, behind the
api-filteringteam flag) and resend/resend-monorepo#14432 (index-backedtomatch). Until the flag is on for a team, the API ignores these params.Linear: MES-2800
Summary by cubic
Adds
to,startDate, andendDatefilters toresend.emails.receiving.list()so users can list the emails an address received without going through threads.inboxes.threads.search(to: string[], camelCase dates).buildInboxCursorUrlhelper, which joinstointo one comma-separated param as the API expects; repeatingtoreturns a 422.limit,after,before) is unchanged.api-filteringteam flag is enabled.Written for commit 614a1ae. Summary will update on new commits.