Skip to content
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

feat: add alias api with previousId support #485

Merged

Conversation

1abhishekpandey
Copy link
Contributor

Description

  • Added an Alias API with previousId support. Now, previousId can be passed and will be preferred over the existing userId or anonymousId.
  • New Alias API:
public void alias(@NonNull String newId, @Nullable RudderOption option, @Nullable String previousId)
  • This is to bring it in parity with the JS SDK so that previousId can be explicitly passed if needed.

NOTE: The change is backwards compatible, as we are introducing a new Alias API which adds a new behaviour to the existing payload schema.

How to test

Objective: We need to test, if previousId is passed then it should be used, else the existing behaviour should continue i.e., userId or anonymousId should be used.

  • Make an alias event and explicitly pass previousId field -> It should be set as the previousId.
  • Existing API: Make an Identify event, then RESET call and then an alias event (with previousId) -> previousId should be set as passed previousId.
  • Existing API: Make an alias event with only newId -> previousId should be set as anonymousId.
  • Existing API: Make an alias event with only newId and options -> previousId should be set as anonymousId.
  • Existing API: Make an identify event and then an alias event (without previousId) -> previousId should be set as previous userId.
  • Existing API: Make an Identify event, then RESET call and then an alias event (without previousId) -> previousId should be set as anonymousId.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • Version upgraded (project, README, gradle, podspec etc)
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added unit tests for the code
  • I have made corresponding changes to the documentation

@1abhishekpandey 1abhishekpandey self-assigned this Dec 2, 2024
@1abhishekpandey 1abhishekpandey requested a review from a team as a code owner December 2, 2024 09:34
@1abhishekpandey 1abhishekpandey requested review from ChryssaAliferi and removed request for a team December 2, 2024 09:34
Copy link

sonarqubecloud bot commented Dec 2, 2024

@1abhishekpandey 1abhishekpandey merged commit 179c262 into develop Dec 6, 2024
35 checks passed
@1abhishekpandey 1abhishekpandey deleted the feat/sdk-2668-add-previousId-support-in-alias-api branch December 6, 2024 10:47
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