-
Notifications
You must be signed in to change notification settings - Fork 3
feat: contacts list segment #87
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
105 changes: 105 additions & 0 deletions
105
src/main/java/com/resend/services/contacts/model/ListContactsOptions.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| package com.resend.services.contacts.model; | ||
|
|
||
| /** | ||
| * Options for listing contacts, optionally scoped to a segment. | ||
| * | ||
| * <p>To list contacts within a segment, provide either {@code segmentId} or the deprecated | ||
| * {@code audienceId}. When both are provided, {@code segmentId} takes precedence.</p> | ||
| * | ||
| * <p>If neither is provided, all global contacts are listed.</p> | ||
| */ | ||
| public class ListContactsOptions { | ||
|
|
||
| private final String segmentId; | ||
|
|
||
| /** | ||
| * @deprecated Use {@link #segmentId} instead. Kept for backward compatibility. | ||
| */ | ||
| @Deprecated | ||
| private final String audienceId; | ||
|
|
||
| private ListContactsOptions(Builder builder) { | ||
| this.segmentId = builder.segmentId; | ||
| this.audienceId = builder.audienceId; | ||
| } | ||
|
|
||
| /** | ||
| * Returns the segment ID, or falls back to {@code audienceId} if {@code segmentId} is not set. | ||
| * | ||
| * @return The resolved segment/audience ID, or {@code null} if neither is set. | ||
| */ | ||
| public String resolvedSegmentId() { | ||
| return segmentId != null ? segmentId : audienceId; | ||
| } | ||
|
|
||
| /** | ||
| * Gets the segment ID. | ||
| * | ||
| * @return The segment ID. | ||
| */ | ||
| public String getSegmentId() { | ||
| return segmentId; | ||
| } | ||
|
|
||
| /** | ||
| * Gets the audience ID. | ||
| * | ||
| * @return The audience ID. | ||
| * @deprecated Use {@link #getSegmentId()} instead. | ||
| */ | ||
| @Deprecated | ||
| public String getAudienceId() { | ||
| return audienceId; | ||
| } | ||
|
|
||
| /** | ||
| * Creates a new builder for {@code ListContactsOptions}. | ||
| * | ||
| * @return A new builder instance. | ||
| */ | ||
| public static Builder builder() { | ||
| return new Builder(); | ||
| } | ||
|
|
||
| /** | ||
| * Builder for {@code ListContactsOptions}. | ||
| */ | ||
| public static class Builder { | ||
|
|
||
| private String segmentId; | ||
| private String audienceId; | ||
|
|
||
| /** | ||
| * Sets the segment ID to scope the contact list. | ||
| * | ||
| * @param segmentId The segment ID. | ||
| * @return This builder. | ||
| */ | ||
| public Builder segmentId(String segmentId) { | ||
| this.segmentId = segmentId; | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| * Sets the audience ID to scope the contact list. | ||
| * | ||
| * @param audienceId The audience ID. | ||
| * @return This builder. | ||
| * @deprecated Use {@link #segmentId(String)} instead. | ||
| */ | ||
| @Deprecated | ||
| public Builder audienceId(String audienceId) { | ||
| this.audienceId = audienceId; | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| * Builds a new {@code ListContactsOptions} instance. | ||
| * | ||
| * @return A new {@code ListContactsOptions}. | ||
| */ | ||
| public ListContactsOptions build() { | ||
| return new ListContactsOptions(this); | ||
| } | ||
| } | ||
| } |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.