All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.evernote.edam.userstore.AuthenticationResult Maven / Gradle / Ivy

The newest version!
/**
 * Autogenerated by Thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 */
package com.evernote.edam.userstore;

import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.Set;
import java.util.HashSet;

import com.evernote.thrift.*;
import com.evernote.thrift.protocol.*;

/**
 *  When an authentication (or re-authentication) is performed, this structure
 *  provides the result to the client.
 * 
*
currentTime:
*
* The server-side date and time when this result was * generated. *
*
authenticationToken:
*
* Holds an opaque, ASCII-encoded token that can be * used by the client to perform actions on a NoteStore. *
*
expiration:
*
* Holds the server-side date and time when the * authentication token will expire. * This time can be compared to "currentTime" to produce an expiration * time that can be reconciled with the client's local clock. *
*
user:
*
* Holds the information about the account which was * authenticated if this was a full authentication. May be absent if this * particular authentication did not require user information. *
*
publicUserInfo:
*
* If this authentication result was achieved without full permissions to * access the full User structure, this field may be set to give back * a more limited public set of data. *
*
noteStoreUrl:
*
* This field will contain the full URL that clients should use to make * NoteStore requests to the server shard that contains that user's data. * I.e. this is the URL that should be used to create the Thrift HTTP client * transport to send messages to the NoteStore service for the account. *
*
webApiUrlPrefix:
*
* This field will contain the initial part of the URLs that should be used * to make requests to Evernote's thin client "web API", which provide * optimized operations for clients that aren't capable of manipulating * the full contents of accounts via the full Thrift data model. Clients * should concatenate the relative path for the various servlets onto the * end of this string to construct the full URL, as documented on our * developer web site. *
*
secondFactorRequired:
*
* If set to true, this field indicates that the user has enabled two-factor * authentication and must enter their second factor in order to complete * authentication. In this case the value of authenticationResult will be * a short-lived authentication token that may only be used to make a * subsequent call to completeTwoFactorAuthentication. *
*
secondFactorDeliveryHint:
*
* When secondFactorRequired is set to true, this field may contain a string * describing the second factor delivery method that the user has configured. * This will typically be an obfuscated mobile device number, such as * "(xxx) xxx-x095". This string can be displayed to the user to remind them * how to obtain the required second factor. * TODO do we need to differentiate between SMS and voice delivery? *
*
*/ public class AuthenticationResult implements TBase, java.io.Serializable, Cloneable { private static final TStruct STRUCT_DESC = new TStruct("AuthenticationResult"); private static final TField CURRENT_TIME_FIELD_DESC = new TField("currentTime", TType.I64, (short)1); private static final TField AUTHENTICATION_TOKEN_FIELD_DESC = new TField("authenticationToken", TType.STRING, (short)2); private static final TField EXPIRATION_FIELD_DESC = new TField("expiration", TType.I64, (short)3); private static final TField USER_FIELD_DESC = new TField("user", TType.STRUCT, (short)4); private static final TField PUBLIC_USER_INFO_FIELD_DESC = new TField("publicUserInfo", TType.STRUCT, (short)5); private static final TField NOTE_STORE_URL_FIELD_DESC = new TField("noteStoreUrl", TType.STRING, (short)6); private static final TField WEB_API_URL_PREFIX_FIELD_DESC = new TField("webApiUrlPrefix", TType.STRING, (short)7); private static final TField SECOND_FACTOR_REQUIRED_FIELD_DESC = new TField("secondFactorRequired", TType.BOOL, (short)8); private static final TField SECOND_FACTOR_DELIVERY_HINT_FIELD_DESC = new TField("secondFactorDeliveryHint", TType.STRING, (short)9); private long currentTime; private String authenticationToken; private long expiration; private com.evernote.edam.type.User user; private PublicUserInfo publicUserInfo; private String noteStoreUrl; private String webApiUrlPrefix; private boolean secondFactorRequired; private String secondFactorDeliveryHint; // isset id assignments private static final int __CURRENTTIME_ISSET_ID = 0; private static final int __EXPIRATION_ISSET_ID = 1; private static final int __SECONDFACTORREQUIRED_ISSET_ID = 2; private boolean[] __isset_vector = new boolean[3]; public AuthenticationResult() { } public AuthenticationResult( long currentTime, String authenticationToken, long expiration) { this(); this.currentTime = currentTime; setCurrentTimeIsSet(true); this.authenticationToken = authenticationToken; this.expiration = expiration; setExpirationIsSet(true); } /** * Performs a deep copy on other. */ public AuthenticationResult(AuthenticationResult other) { System.arraycopy(other.__isset_vector, 0, __isset_vector, 0, other.__isset_vector.length); this.currentTime = other.currentTime; if (other.isSetAuthenticationToken()) { this.authenticationToken = other.authenticationToken; } this.expiration = other.expiration; if (other.isSetUser()) { this.user = new com.evernote.edam.type.User(other.user); } if (other.isSetPublicUserInfo()) { this.publicUserInfo = new PublicUserInfo(other.publicUserInfo); } if (other.isSetNoteStoreUrl()) { this.noteStoreUrl = other.noteStoreUrl; } if (other.isSetWebApiUrlPrefix()) { this.webApiUrlPrefix = other.webApiUrlPrefix; } this.secondFactorRequired = other.secondFactorRequired; if (other.isSetSecondFactorDeliveryHint()) { this.secondFactorDeliveryHint = other.secondFactorDeliveryHint; } } public AuthenticationResult deepCopy() { return new AuthenticationResult(this); } public void clear() { setCurrentTimeIsSet(false); this.currentTime = 0; this.authenticationToken = null; setExpirationIsSet(false); this.expiration = 0; this.user = null; this.publicUserInfo = null; this.noteStoreUrl = null; this.webApiUrlPrefix = null; setSecondFactorRequiredIsSet(false); this.secondFactorRequired = false; this.secondFactorDeliveryHint = null; } public long getCurrentTime() { return this.currentTime; } public void setCurrentTime(long currentTime) { this.currentTime = currentTime; setCurrentTimeIsSet(true); } public void unsetCurrentTime() { __isset_vector[__CURRENTTIME_ISSET_ID] = false; } /** Returns true if field currentTime is set (has been asigned a value) and false otherwise */ public boolean isSetCurrentTime() { return __isset_vector[__CURRENTTIME_ISSET_ID]; } public void setCurrentTimeIsSet(boolean value) { __isset_vector[__CURRENTTIME_ISSET_ID] = value; } public String getAuthenticationToken() { return this.authenticationToken; } public void setAuthenticationToken(String authenticationToken) { this.authenticationToken = authenticationToken; } public void unsetAuthenticationToken() { this.authenticationToken = null; } /** Returns true if field authenticationToken is set (has been asigned a value) and false otherwise */ public boolean isSetAuthenticationToken() { return this.authenticationToken != null; } public void setAuthenticationTokenIsSet(boolean value) { if (!value) { this.authenticationToken = null; } } public long getExpiration() { return this.expiration; } public void setExpiration(long expiration) { this.expiration = expiration; setExpirationIsSet(true); } public void unsetExpiration() { __isset_vector[__EXPIRATION_ISSET_ID] = false; } /** Returns true if field expiration is set (has been asigned a value) and false otherwise */ public boolean isSetExpiration() { return __isset_vector[__EXPIRATION_ISSET_ID]; } public void setExpirationIsSet(boolean value) { __isset_vector[__EXPIRATION_ISSET_ID] = value; } public com.evernote.edam.type.User getUser() { return this.user; } public void setUser(com.evernote.edam.type.User user) { this.user = user; } public void unsetUser() { this.user = null; } /** Returns true if field user is set (has been asigned a value) and false otherwise */ public boolean isSetUser() { return this.user != null; } public void setUserIsSet(boolean value) { if (!value) { this.user = null; } } public PublicUserInfo getPublicUserInfo() { return this.publicUserInfo; } public void setPublicUserInfo(PublicUserInfo publicUserInfo) { this.publicUserInfo = publicUserInfo; } public void unsetPublicUserInfo() { this.publicUserInfo = null; } /** Returns true if field publicUserInfo is set (has been asigned a value) and false otherwise */ public boolean isSetPublicUserInfo() { return this.publicUserInfo != null; } public void setPublicUserInfoIsSet(boolean value) { if (!value) { this.publicUserInfo = null; } } public String getNoteStoreUrl() { return this.noteStoreUrl; } public void setNoteStoreUrl(String noteStoreUrl) { this.noteStoreUrl = noteStoreUrl; } public void unsetNoteStoreUrl() { this.noteStoreUrl = null; } /** Returns true if field noteStoreUrl is set (has been asigned a value) and false otherwise */ public boolean isSetNoteStoreUrl() { return this.noteStoreUrl != null; } public void setNoteStoreUrlIsSet(boolean value) { if (!value) { this.noteStoreUrl = null; } } public String getWebApiUrlPrefix() { return this.webApiUrlPrefix; } public void setWebApiUrlPrefix(String webApiUrlPrefix) { this.webApiUrlPrefix = webApiUrlPrefix; } public void unsetWebApiUrlPrefix() { this.webApiUrlPrefix = null; } /** Returns true if field webApiUrlPrefix is set (has been asigned a value) and false otherwise */ public boolean isSetWebApiUrlPrefix() { return this.webApiUrlPrefix != null; } public void setWebApiUrlPrefixIsSet(boolean value) { if (!value) { this.webApiUrlPrefix = null; } } public boolean isSecondFactorRequired() { return this.secondFactorRequired; } public void setSecondFactorRequired(boolean secondFactorRequired) { this.secondFactorRequired = secondFactorRequired; setSecondFactorRequiredIsSet(true); } public void unsetSecondFactorRequired() { __isset_vector[__SECONDFACTORREQUIRED_ISSET_ID] = false; } /** Returns true if field secondFactorRequired is set (has been asigned a value) and false otherwise */ public boolean isSetSecondFactorRequired() { return __isset_vector[__SECONDFACTORREQUIRED_ISSET_ID]; } public void setSecondFactorRequiredIsSet(boolean value) { __isset_vector[__SECONDFACTORREQUIRED_ISSET_ID] = value; } public String getSecondFactorDeliveryHint() { return this.secondFactorDeliveryHint; } public void setSecondFactorDeliveryHint(String secondFactorDeliveryHint) { this.secondFactorDeliveryHint = secondFactorDeliveryHint; } public void unsetSecondFactorDeliveryHint() { this.secondFactorDeliveryHint = null; } /** Returns true if field secondFactorDeliveryHint is set (has been asigned a value) and false otherwise */ public boolean isSetSecondFactorDeliveryHint() { return this.secondFactorDeliveryHint != null; } public void setSecondFactorDeliveryHintIsSet(boolean value) { if (!value) { this.secondFactorDeliveryHint = null; } } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof AuthenticationResult) return this.equals((AuthenticationResult)that); return false; } public boolean equals(AuthenticationResult that) { if (that == null) return false; boolean this_present_currentTime = true; boolean that_present_currentTime = true; if (this_present_currentTime || that_present_currentTime) { if (!(this_present_currentTime && that_present_currentTime)) return false; if (this.currentTime != that.currentTime) return false; } boolean this_present_authenticationToken = true && this.isSetAuthenticationToken(); boolean that_present_authenticationToken = true && that.isSetAuthenticationToken(); if (this_present_authenticationToken || that_present_authenticationToken) { if (!(this_present_authenticationToken && that_present_authenticationToken)) return false; if (!this.authenticationToken.equals(that.authenticationToken)) return false; } boolean this_present_expiration = true; boolean that_present_expiration = true; if (this_present_expiration || that_present_expiration) { if (!(this_present_expiration && that_present_expiration)) return false; if (this.expiration != that.expiration) return false; } boolean this_present_user = true && this.isSetUser(); boolean that_present_user = true && that.isSetUser(); if (this_present_user || that_present_user) { if (!(this_present_user && that_present_user)) return false; if (!this.user.equals(that.user)) return false; } boolean this_present_publicUserInfo = true && this.isSetPublicUserInfo(); boolean that_present_publicUserInfo = true && that.isSetPublicUserInfo(); if (this_present_publicUserInfo || that_present_publicUserInfo) { if (!(this_present_publicUserInfo && that_present_publicUserInfo)) return false; if (!this.publicUserInfo.equals(that.publicUserInfo)) return false; } boolean this_present_noteStoreUrl = true && this.isSetNoteStoreUrl(); boolean that_present_noteStoreUrl = true && that.isSetNoteStoreUrl(); if (this_present_noteStoreUrl || that_present_noteStoreUrl) { if (!(this_present_noteStoreUrl && that_present_noteStoreUrl)) return false; if (!this.noteStoreUrl.equals(that.noteStoreUrl)) return false; } boolean this_present_webApiUrlPrefix = true && this.isSetWebApiUrlPrefix(); boolean that_present_webApiUrlPrefix = true && that.isSetWebApiUrlPrefix(); if (this_present_webApiUrlPrefix || that_present_webApiUrlPrefix) { if (!(this_present_webApiUrlPrefix && that_present_webApiUrlPrefix)) return false; if (!this.webApiUrlPrefix.equals(that.webApiUrlPrefix)) return false; } boolean this_present_secondFactorRequired = true && this.isSetSecondFactorRequired(); boolean that_present_secondFactorRequired = true && that.isSetSecondFactorRequired(); if (this_present_secondFactorRequired || that_present_secondFactorRequired) { if (!(this_present_secondFactorRequired && that_present_secondFactorRequired)) return false; if (this.secondFactorRequired != that.secondFactorRequired) return false; } boolean this_present_secondFactorDeliveryHint = true && this.isSetSecondFactorDeliveryHint(); boolean that_present_secondFactorDeliveryHint = true && that.isSetSecondFactorDeliveryHint(); if (this_present_secondFactorDeliveryHint || that_present_secondFactorDeliveryHint) { if (!(this_present_secondFactorDeliveryHint && that_present_secondFactorDeliveryHint)) return false; if (!this.secondFactorDeliveryHint.equals(that.secondFactorDeliveryHint)) return false; } return true; } @Override public int hashCode() { return 0; } public int compareTo(AuthenticationResult other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; AuthenticationResult typedOther = (AuthenticationResult)other; lastComparison = Boolean.valueOf(isSetCurrentTime()).compareTo(typedOther.isSetCurrentTime()); if (lastComparison != 0) { return lastComparison; } if (isSetCurrentTime()) { lastComparison = TBaseHelper.compareTo(this.currentTime, typedOther.currentTime); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetAuthenticationToken()).compareTo(typedOther.isSetAuthenticationToken()); if (lastComparison != 0) { return lastComparison; } if (isSetAuthenticationToken()) { lastComparison = TBaseHelper.compareTo(this.authenticationToken, typedOther.authenticationToken); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetExpiration()).compareTo(typedOther.isSetExpiration()); if (lastComparison != 0) { return lastComparison; } if (isSetExpiration()) { lastComparison = TBaseHelper.compareTo(this.expiration, typedOther.expiration); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetUser()).compareTo(typedOther.isSetUser()); if (lastComparison != 0) { return lastComparison; } if (isSetUser()) { lastComparison = TBaseHelper.compareTo(this.user, typedOther.user); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetPublicUserInfo()).compareTo(typedOther.isSetPublicUserInfo()); if (lastComparison != 0) { return lastComparison; } if (isSetPublicUserInfo()) { lastComparison = TBaseHelper.compareTo(this.publicUserInfo, typedOther.publicUserInfo); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetNoteStoreUrl()).compareTo(typedOther.isSetNoteStoreUrl()); if (lastComparison != 0) { return lastComparison; } if (isSetNoteStoreUrl()) { lastComparison = TBaseHelper.compareTo(this.noteStoreUrl, typedOther.noteStoreUrl); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetWebApiUrlPrefix()).compareTo(typedOther.isSetWebApiUrlPrefix()); if (lastComparison != 0) { return lastComparison; } if (isSetWebApiUrlPrefix()) { lastComparison = TBaseHelper.compareTo(this.webApiUrlPrefix, typedOther.webApiUrlPrefix); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetSecondFactorRequired()).compareTo(typedOther.isSetSecondFactorRequired()); if (lastComparison != 0) { return lastComparison; } if (isSetSecondFactorRequired()) { lastComparison = TBaseHelper.compareTo(this.secondFactorRequired, typedOther.secondFactorRequired); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetSecondFactorDeliveryHint()).compareTo(typedOther.isSetSecondFactorDeliveryHint()); if (lastComparison != 0) { return lastComparison; } if (isSetSecondFactorDeliveryHint()) { lastComparison = TBaseHelper.compareTo(this.secondFactorDeliveryHint, typedOther.secondFactorDeliveryHint); if (lastComparison != 0) { return lastComparison; } } return 0; } public void read(TProtocol iprot) throws TException { TField field; iprot.readStructBegin(); while (true) { field = iprot.readFieldBegin(); if (field.type == TType.STOP) { break; } switch (field.id) { case 1: // CURRENT_TIME if (field.type == TType.I64) { this.currentTime = iprot.readI64(); setCurrentTimeIsSet(true); } else { TProtocolUtil.skip(iprot, field.type); } break; case 2: // AUTHENTICATION_TOKEN if (field.type == TType.STRING) { this.authenticationToken = iprot.readString(); } else { TProtocolUtil.skip(iprot, field.type); } break; case 3: // EXPIRATION if (field.type == TType.I64) { this.expiration = iprot.readI64(); setExpirationIsSet(true); } else { TProtocolUtil.skip(iprot, field.type); } break; case 4: // USER if (field.type == TType.STRUCT) { this.user = new com.evernote.edam.type.User(); this.user.read(iprot); } else { TProtocolUtil.skip(iprot, field.type); } break; case 5: // PUBLIC_USER_INFO if (field.type == TType.STRUCT) { this.publicUserInfo = new PublicUserInfo(); this.publicUserInfo.read(iprot); } else { TProtocolUtil.skip(iprot, field.type); } break; case 6: // NOTE_STORE_URL if (field.type == TType.STRING) { this.noteStoreUrl = iprot.readString(); } else { TProtocolUtil.skip(iprot, field.type); } break; case 7: // WEB_API_URL_PREFIX if (field.type == TType.STRING) { this.webApiUrlPrefix = iprot.readString(); } else { TProtocolUtil.skip(iprot, field.type); } break; case 8: // SECOND_FACTOR_REQUIRED if (field.type == TType.BOOL) { this.secondFactorRequired = iprot.readBool(); setSecondFactorRequiredIsSet(true); } else { TProtocolUtil.skip(iprot, field.type); } break; case 9: // SECOND_FACTOR_DELIVERY_HINT if (field.type == TType.STRING) { this.secondFactorDeliveryHint = iprot.readString(); } else { TProtocolUtil.skip(iprot, field.type); } break; default: TProtocolUtil.skip(iprot, field.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); validate(); } public void write(TProtocol oprot) throws TException { validate(); oprot.writeStructBegin(STRUCT_DESC); oprot.writeFieldBegin(CURRENT_TIME_FIELD_DESC); oprot.writeI64(this.currentTime); oprot.writeFieldEnd(); if (this.authenticationToken != null) { oprot.writeFieldBegin(AUTHENTICATION_TOKEN_FIELD_DESC); oprot.writeString(this.authenticationToken); oprot.writeFieldEnd(); } oprot.writeFieldBegin(EXPIRATION_FIELD_DESC); oprot.writeI64(this.expiration); oprot.writeFieldEnd(); if (this.user != null) { if (isSetUser()) { oprot.writeFieldBegin(USER_FIELD_DESC); this.user.write(oprot); oprot.writeFieldEnd(); } } if (this.publicUserInfo != null) { if (isSetPublicUserInfo()) { oprot.writeFieldBegin(PUBLIC_USER_INFO_FIELD_DESC); this.publicUserInfo.write(oprot); oprot.writeFieldEnd(); } } if (this.noteStoreUrl != null) { if (isSetNoteStoreUrl()) { oprot.writeFieldBegin(NOTE_STORE_URL_FIELD_DESC); oprot.writeString(this.noteStoreUrl); oprot.writeFieldEnd(); } } if (this.webApiUrlPrefix != null) { if (isSetWebApiUrlPrefix()) { oprot.writeFieldBegin(WEB_API_URL_PREFIX_FIELD_DESC); oprot.writeString(this.webApiUrlPrefix); oprot.writeFieldEnd(); } } if (isSetSecondFactorRequired()) { oprot.writeFieldBegin(SECOND_FACTOR_REQUIRED_FIELD_DESC); oprot.writeBool(this.secondFactorRequired); oprot.writeFieldEnd(); } if (this.secondFactorDeliveryHint != null) { if (isSetSecondFactorDeliveryHint()) { oprot.writeFieldBegin(SECOND_FACTOR_DELIVERY_HINT_FIELD_DESC); oprot.writeString(this.secondFactorDeliveryHint); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); } @Override public String toString() { StringBuilder sb = new StringBuilder("AuthenticationResult("); boolean first = true; sb.append("currentTime:"); sb.append(this.currentTime); first = false; if (!first) sb.append(", "); sb.append("authenticationToken:"); if (this.authenticationToken == null) { sb.append("null"); } else { sb.append(this.authenticationToken); } first = false; if (!first) sb.append(", "); sb.append("expiration:"); sb.append(this.expiration); first = false; if (isSetUser()) { if (!first) sb.append(", "); sb.append("user:"); if (this.user == null) { sb.append("null"); } else { sb.append(this.user); } first = false; } if (isSetPublicUserInfo()) { if (!first) sb.append(", "); sb.append("publicUserInfo:"); if (this.publicUserInfo == null) { sb.append("null"); } else { sb.append(this.publicUserInfo); } first = false; } if (isSetNoteStoreUrl()) { if (!first) sb.append(", "); sb.append("noteStoreUrl:"); if (this.noteStoreUrl == null) { sb.append("null"); } else { sb.append(this.noteStoreUrl); } first = false; } if (isSetWebApiUrlPrefix()) { if (!first) sb.append(", "); sb.append("webApiUrlPrefix:"); if (this.webApiUrlPrefix == null) { sb.append("null"); } else { sb.append(this.webApiUrlPrefix); } first = false; } if (isSetSecondFactorRequired()) { if (!first) sb.append(", "); sb.append("secondFactorRequired:"); sb.append(this.secondFactorRequired); first = false; } if (isSetSecondFactorDeliveryHint()) { if (!first) sb.append(", "); sb.append("secondFactorDeliveryHint:"); if (this.secondFactorDeliveryHint == null) { sb.append("null"); } else { sb.append(this.secondFactorDeliveryHint); } first = false; } sb.append(")"); return sb.toString(); } public void validate() throws TException { // check for required fields if (!isSetCurrentTime()) { throw new TProtocolException("Required field 'currentTime' is unset! Struct:" + toString()); } if (!isSetAuthenticationToken()) { throw new TProtocolException("Required field 'authenticationToken' is unset! Struct:" + toString()); } if (!isSetExpiration()) { throw new TProtocolException("Required field 'expiration' is unset! Struct:" + toString()); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy