Skip to content

Commit

Permalink
Remove isAnonymous property
Browse files Browse the repository at this point in the history
  • Loading branch information
denis-rossati committed Nov 19, 2024
1 parent b6cc776 commit 91b3301
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 28 deletions.
15 changes: 9 additions & 6 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,7 @@ components:
userId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
parentId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
referrer: referrer
isAnonymous: true
externalUserId: j0hn
closeTime: 1
campaign:
name: name
Expand Down Expand Up @@ -1317,9 +1317,12 @@ components:
format: uuid
nullable: true
type: string
isAnonymous:
description: The flag that indicates whether the user is anonymous.
type: boolean
externalUserId:
description: "The external user ID that is used to identify the user on\
\ the application side, unique across the workspace. It is always null\
\ for anonymous users."
nullable: true
type: string
window:
$ref: '#/components/schemas/Session_window'
closeTime:
Expand Down Expand Up @@ -1361,7 +1364,7 @@ components:
userId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
parentId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
referrer: referrer
isAnonymous: true
externalUserId: j0hn
closeTime: 1
campaign:
name: name
Expand Down Expand Up @@ -1408,7 +1411,7 @@ components:
userId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
parentId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
referrer: referrer
isAnonymous: true
externalUserId: j0hn
closeTime: 1
campaign:
name: name
Expand Down
45 changes: 23 additions & 22 deletions src/main/java/com/croct/client/export/model/Session.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
Session.JSON_PROPERTY_SESSION_ID,
Session.JSON_PROPERTY_USER_ID,
Session.JSON_PROPERTY_PARENT_ID,
Session.JSON_PROPERTY_IS_ANONYMOUS,
Session.JSON_PROPERTY_EXTERNAL_USER_ID,
Session.JSON_PROPERTY_WINDOW,
Session.JSON_PROPERTY_CLOSE_TIME,
Session.JSON_PROPERTY_REFERRER,
Expand All @@ -67,8 +67,8 @@ public class Session {
public static final String JSON_PROPERTY_PARENT_ID = "parentId";
private JsonNullable<UUID> parentId = JsonNullable.<UUID>undefined();

public static final String JSON_PROPERTY_IS_ANONYMOUS = "isAnonymous";
private Boolean isAnonymous;
public static final String JSON_PROPERTY_EXTERNAL_USER_ID = "externalUserId";
private JsonNullable<String> externalUserId = JsonNullable.undefined();

public static final String JSON_PROPERTY_WINDOW = "window";
private SessionWindow window;
Expand Down Expand Up @@ -182,31 +182,32 @@ public void setParentId(UUID parentId) {
this.parentId = JsonNullable.<UUID>of(parentId);
}

/**
* The external user ID that is used to identify the user on the application side, unique across the workspace. It is always null for anonymous users.
* @return externalUserId
**/
@javax.annotation.Nullable
@JsonIgnore

public Session isAnonymous(Boolean isAnonymous) {
this.isAnonymous = isAnonymous;
return this;
public String getExternalUserId() {
return externalUserId.orElse(null);
}

/**
* The flag that indicates whether the user is anonymous.
* @return isAnonymous
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_IS_ANONYMOUS)
@JsonProperty(JSON_PROPERTY_EXTERNAL_USER_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public Boolean getIsAnonymous() {
return isAnonymous;
public JsonNullable<String> getExternalUserId_JsonNullable() {
return externalUserId;
}


@JsonProperty(JSON_PROPERTY_IS_ANONYMOUS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setIsAnonymous(Boolean isAnonymous) {
this.isAnonymous = isAnonymous;
@JsonProperty(JSON_PROPERTY_EXTERNAL_USER_ID)
public void setExternalUserId_JsonNullable(JsonNullable<String> externalUserId) {
this.externalUserId = externalUserId;
}

public void setExternalUserId(String externalUserId) {
this.externalUserId = JsonNullable.<String>of(externalUserId);
}

public Session window(SessionWindow window) {
this.window = window;
Expand Down Expand Up @@ -472,7 +473,7 @@ public boolean equals(Object o) {
return Objects.equals(this.sessionId, session.sessionId) &&
Objects.equals(this.userId, session.userId) &&
equalsNullable(this.parentId, session.parentId) &&
Objects.equals(this.isAnonymous, session.isAnonymous) &&
Objects.equals(this.externalUserId, session.externalUserId) &&
Objects.equals(this.window, session.window) &&
Objects.equals(this.closeTime, session.closeTime) &&
equalsNullable(this.referrer, session.referrer) &&
Expand All @@ -490,7 +491,7 @@ private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b)

@Override
public int hashCode() {
return Objects.hash(sessionId, userId, hashCodeNullable(parentId), isAnonymous, window, closeTime, hashCodeNullable(referrer), hashCodeNullable(landingPageUrl), campaign, location, client, attributes, statistics);
return Objects.hash(sessionId, userId, hashCodeNullable(parentId), hashCodeNullable(externalUserId), window, closeTime, hashCodeNullable(referrer), hashCodeNullable(landingPageUrl), campaign, location, client, attributes, statistics);
}

private static <T> int hashCodeNullable(JsonNullable<T> a) {
Expand All @@ -507,7 +508,7 @@ public String toString() {
sb.append(" sessionId: ").append(toIndentedString(sessionId)).append("\n");
sb.append(" userId: ").append(toIndentedString(userId)).append("\n");
sb.append(" parentId: ").append(toIndentedString(parentId)).append("\n");
sb.append(" isAnonymous: ").append(toIndentedString(isAnonymous)).append("\n");
sb.append(" externalUserId: ").append(toIndentedString(externalUserId)).append("\n");
sb.append(" window: ").append(toIndentedString(window)).append("\n");
sb.append(" closeTime: ").append(toIndentedString(closeTime)).append("\n");
sb.append(" referrer: ").append(toIndentedString(referrer)).append("\n");
Expand Down

0 comments on commit 91b3301

Please sign in to comment.