Rev 1599 | Rev 1848 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
namespace java in.shop2020.model.v1.usernamespace py shop2020.thriftpy.model.v1.user/**Exceptions*/exception AuthenticationException{1:string message,2:i32 errorCode}exception UserContextException{1:i32 errorCode,2:string message}exception ShoppingCartException{1:i64 id,2:string message}exception UserCommunicationException{1:i64 id,2:string message}enum UserType{USER = 0,ANONYMOUS = 1}enum AddressType{WORK = 0,HOME = 1}enum PhoneType{WORK = 0,HOME = 1,MOBILE = 2}enum AccountStatus{ACTIVE = 0,DELETED = 1,INACTIVE = 2,INCOMPLETE = 3}/**Form types for Contact Us form*/enum UserCommunicationType{RETURN_FORM = 1,ORDER_CANCELLATION = 2,DELIVERY_PROBLEM = 3,PAYMENT_STATUS = 4,ORDER_STATUS = 5,PRODUCT_REQUEST = 6,PRODUCT_QUESTION = 7,OTHER = 7}/**All the social handles*/struct SocialHandles{1:string facebook,2:string opensocial,3:string twitter}/**Address*/struct Address{1:i64 id,2:string line1,3:string line2,4:string landmark,5:string city,6:string state,7:string pin,8:string country,9:bool enabled,10:AddressType type,11:i64 addedOn,12:string name,13:string phone}/**Phone**/struct Phone{1:i64 id,2:string countryCode,3:string areaCode,4:string number,5:string extension,6:PhoneType type}/**Internal information to be used by system. various variables which aid in serving the user are identified and put here**/struct UserInternalInfo{1:i64 userId,2:i64 geoZone,3:i64 shipmentZone,4:i64 taxZone,5:double userRankScore}/**structure representing timestamp and ip at which user logged into the system**/struct IPMap{1:i64 timestamp2:string ip}/**dynamic user state**/struct UserState{1:i64 userId,2:i64 lastLogin,3:i64 lastLogout,4:i64 emailVerificationSentOn,5:i64 smsVerificationSentOn,6:bool isEmailVerified,7:bool isSMSVerified,8:i64 activeSince,9:list<IPMap> ips,10:AccountStatus status}enum Sex{MALE,FEMALE,WONT_SAY}/**The user structure holding the basic information that identifies the user.**/struct User{1:i64 userId,2:string email,3:string password,4:string name,5:string dateOfBirth,6:Sex sex,7:string mobileNumber,8:SocialHandles socialHandles,9:list<Address> addresses,10:i64 defaultAddressId,11:string communicationEmail,12:i64 activeCartId,13:string jsessionId,14:bool isAnonymous}struct UserCommunication{1:i64 id,2:i64 userId,3:UserCommunicationType communicationType,4:i64 orderId,5:string airwaybillNo,6:string replyTo,7:string productName,8:string subject,9:string message,10:i64 communication_timestamp}//Various statuses for line itemsenum LineStatus{LINE_ACTIVE, //line is activeLINE_DELETED, //line is deletedLINE_EXPIRED, //line is expired, on laspse of fixed amount of timeLINE_COMMITED, //line is committed, sent for processing.LINE_COMMIT_FAILED, //line was committed, but commit failed due to some reason, possibly during cart validation.LINE_AUTO_DELETED, //line was auto deleted internally due to some reason(item delisted, price changed etc).}//Various statuses for Cartenum CartStatus{ACTIVE,INACTIVE,EXPIRED,COMMITTED,COMMIT_FAILED}struct Line{1:i64 cartId, //identifier2:i64 itemId, //item id added3:double quantity, //quantity added4:i64 createdOn, //addition timestamp5:i64 updatedOn, //any updation in quantity or status6:LineStatus lineStatus, //current status7:i32 estimate //delivery estimate in hours}struct Cart{1:i64 id, //identifier2:list<Line> lines, //list of lines3:CartStatus status, //current status4:i64 createdOn, //creation timestamp5:i64 updatedOn, //time of last update in cart (like addition/deletion/updation of cart items )6:i64 checkedOutOn, //commited timestamp7:i64 userId, //user id to which it belongs8:i64 addressId, //address on which this will be shipped}enum WidgetType{MY_RESEARCH,BROWSE_HISTORY}/** Not used right now, will decide laterenum WidgetType{ACCESSORIES,RATINGS,SIMILAR_ITEMS,RECOMMENDED_ITEMS,DEAL_PROMOTIONS,MY_RESEARCH,BROWSE_HISTORY}enum RatingType{SHOP2020,AMAZON,USER_ALL,USER_CURRENT}struct RatingsWidget{1:i64 catalog_item_id,2:map<RatingType,double> ratings,3:i64 user_id}*/struct WidgetItem{1:i64 id,2:i64 item_id,3:bool enabled,4:i64 timestamp}struct Widget{1:i64 id,2:WidgetType type,3:i64 user_id,4:list<WidgetItem> items,5:bool enabled,6:string name}exception WidgetException{1:i64 id,2:string message}/**service*/service UserContextService{/*** For closing the open session in sqlalchemy*/void closeSession(),User createAnonymousUser(1:string jsessionId) throws (1:UserContextException ucex),User getUserById(1:i64 userId) throws (1:UserContextException ucex),User getUserByEmail(1:string email) throws (1:UserContextException ucex),User createUser(1:User user) throws (1:UserContextException ucex),User updateUser(1:User user) throws (1:UserContextException ucex),bool deleteUser(1:i64 userId) throws (1:UserContextException ucex),UserState getUserState(1:i64 userId) throws (1:UserContextException ucex),User authenticateUser(1:string email, 2:string password) throws (1:AuthenticationException auex),bool userExists(1:string email) throws (1:UserContextException ucx),i64 addAddressForUser(1:i64 userId, 2:Address address, 3:bool setDefault)throws (1:UserContextException ucx),bool removeAddressForUser(1:i64 userid, 2:i64 addressId)throws (1:UserContextException ucx),bool setUserAsLoggedIn(1:i64 userId, 2:i64 timestamp)throws (1:UserContextException ucx),bool setUserAsLoggedOut(1:i64 userid, 2:i64 timestamp)throws (1:UserContextException ucx),bool setDefaultAddress(1:i64 userid, 2:i64 addressId)throws (1:UserContextException ucx),bool updatePassword(1:i64 userid, 2:string oldPassword, 3:string newPassword)throws (1:UserContextException ucx),bool forgotPassword(1:string email, 2:string newPassword)throws (1:UserContextException ucx),list<Address> getAllAddressesForUser(1:i64 userId)throws (1:UserContextException ucx),i64 getDefaultAddressId(1:i64 userId)throws (1:UserContextException ucx),string getDefaultPincode(1:i64 userId)throws (1:UserContextException ucx),bool saveUserCommunication(1:i64 userId, 2:string replyTo, 3:i64 communicationType, 4:i64 orderId, 5:string airwaybillNo, 6:string productName, 7:string subject, 8:string message)throws (1:UserCommunicationException ucx)UserCommunication getUserCommunicationById(1:i64 id) throws (1:UserCommunicationException ucx)list<UserCommunication> getUserCommunicationByUser(1:i64 userId) throws (1:UserCommunicationException ucx)list<UserCommunication> getAllUserCommunications() throws (1:UserCommunicationException ucx)i64 createCart(1:i64 userId) throws (1:ShoppingCartException scx),Cart getCurrentCart(1:i64 userId) throws (1:ShoppingCartException scx),Cart getCart(1:i64 cartId) throws (1:ShoppingCartException scx),list<Cart> getCartsForUser(1:i64 userId, 2:CartStatus status) throws (1:ShoppingCartException scx),list<Cart> getCartsByStatus(1:CartStatus status) throws (1:ShoppingCartException scx),list<Cart> getCartsByTime(1:i64 from_time, 2:i64 to_time, 3:CartStatus status) throws (1:ShoppingCartException scx),void changeCartStatus(1:i64 cartId, 2:CartStatus status) throws (1:ShoppingCartException scx),void addItemToCart(1:i64 cartId, 2:i64 itemId, 3:i64 quantity) throws (1:ShoppingCartException scx),void deleteItemFromCart(1:i64 cartId, 2:i64 itemId) throws (1:ShoppingCartException scx),void changeQuantity(1:i64 cartId, 2:i64 itemId, 3:i64 quantity) throws (1:ShoppingCartException scx),void changeItemStatus(1:i64 cartId, 2:i64 itemId, 3:LineStatus status) throws (1:ShoppingCartException scx),void addAddressToCart(1:i64 cartId, 2:i64 addressId) throws (1:ShoppingCartException scx),/**Creates a transaction and multiple orders for the given cart. Returns the transaction ID created.*/i64 createOrders(1:i64 cartId) throws (1:ShoppingCartException scx),/**Validates that:1. The checkout timestamp is greater than the updatedOn timestamp.2. All of the lines in the cart are active items.3. The estimate for any of the lines in cart doesn't change.If all three are true, returns empty string; else returns appropriate message.*/string validateCart(1:i64 cartId) throws (1:ShoppingCartException scex),/**Merges the lines from the first cart into the second cart. Lines with duplicate items are removed.*/void mergeCart(1:i64 fromCartId, 2:i64 toCartId),/**Sets the checkedOutOn timestamp of the cart. Raises an exception if the specified cart can't be found.*/bool checkOut(1:i64 cartId) throws (1:ShoppingCartException scex),/**The second parameter is a map of item ids and their quantities which have been successfully processed.This methods removes the specified quantiry of the specified item from the cart.*/bool resetCart(1:i64 cartId, 2:map<i64, double> items) throws (1:ShoppingCartException scex),/*** Widgets*/Widget getMyResearch(1:i64 userId) throws (1:WidgetException scx),bool updateMyResearch(1:i64 userId, 2:i64 itemId) throws (1:WidgetException scx),void deleteItemFromMyResearch(1:i64 userId, 2:i64 itemId) throws (1:WidgetException scx),void updateBrowseHistory(1:i64 userId, 2:i64 itemId),Widget getBrowseHistory(1:i64 userId) throws (1:WidgetException scx),void mergeBrowseHistory(1:i64 fromUserId, 2:i64 toUserId),/**Returns number of registered users.If userType = null, then it returns count of all users, including anonymousIf userType = UserType.ANONYMOUS, then it returns count of anonymous users onlyIf userType = UserType.USER, then it returns count of non-anonymous users only*/i64 getUserCount(1:UserType userType),/**Returns list of users of type userType. If userType is null, then returns all the users.*/list<User> getAllUsers(1: UserType userType)/** Masking right now. May be used later.void addWidget(1:Widget widget) throws (1:WidgetException scx),void addItemToWidget(1:i64 widget_id, 2:list<i64> items) throws (1:WidgetException scx),void deleteItemFromWidget(1:i64 widget_id, 2:i64 item_id) throws (1:WidgetException scx),void updateWidget(1:i64 widgetId, 2:bool enable) throws (1:WidgetException scx),void updateWidgetItem(1:i64 widgetId, 2:bool enable) throws (1:WidgetException scx),Widget getWidget(1:WidgetType type, 2:i64 userId, 3:bool onlyEnabled) throws (1:WidgetException scx),*/}