Subversion Repositories SmartDukaan

Rev

Rev 48 | Rev 121 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

namespace java in.shop2020.model.v1.user
namespace py shop2020.thriftpy.model.v1.user

/**
Exceptions
*/


exception AuthenticationException{
        1:string message,
        2:i32 errorCode
}

exception UserContextException{
        1:i32 errorCode,
        2:string message
}

enum TAddressType{
        WORK,
        HOME
}

/**
structs
*/
struct TSocialHandles{
        1:string facebook,
        2:string opensocial,
        3:string twitter
}

struct TAddress{
        1:string line1,
        2:string line2,
        3:string landmark,
        4:string city,
        5:string state,
        6:string pin,
        7:string country,
        8:i64 id,
        9:bool enabled,
        10:TAddressType type,
        11:i64 addedOn
}

struct TUserPrimaryInfo{
        1:i64 userId,
        2:string title,
        3:string firstName,
        4:string lastName,
        5:string pictureUrl,
        6:string email,
        7:string mobile,
        8:string workPhone,
        9:string userHandle,
        10:string password,
        11:TSocialHandles socialHandles,
        12:i64 dateOfBirth,
        13:i64 anniversary,
        14:set<TAddress> addresses,
        16:i32 shipmentOption,
        17:string middleName,
        18:string occupation
}

struct TUserInternalInfo{
        1:i64 userId,
        2:i32 geoZone,
        3:i32 shipmentZone,
        4:i64 taxZone,
        5:double userRankScore
}

struct TIPMap{
        1:map<i64,string> ips
}

struct TUserState{
        1:i64 userId,
        2:bool isEmailVerified,
        3:i64 lastLogin,
        4:i64 lastLogout,
        5:i64 emailVerificationSentOn,
        6:i64 smsVerificationSentOn,
        7:bool isSMSVerified,
        8:i64 activeSince,
        9:bool isLoggedIn,
        10:TIPMap ipMap 
}

struct TUserContext{
        1:TUserPrimaryInfo primaryInfo,
        2:TUserInternalInfo internalInfo,
        3:TUserState userState,
        4:i64 id
}

/**
service
*/

service UserContextService{
        TUserContext createContext(1: TUserContext context, 2: bool updateExisting) throws (1:UserContextException cex),
        TUserContext getContextFromId(1:i64 userId) throws (1:UserContextException ucx),
        TUserContext getContextFromEmailOrHandle(1:string emailorhandle, 2:bool isEmail) throws (1:UserContextException ucx),
        TUserState getState(1:i64 userId) throws (1:UserContextException ucx),
        TUserPrimaryInfo getPrimaryInfo(1:i64 userId) throws (1:UserContextException ucx),
        TUserInternalInfo getInternalInfo(1:i64 userId) throws (1:UserContextException ucx),
        TUserContext getContext(1:string email, 2:string password) throws (1:AuthenticationException ax),
        bool userExists(1:string email)throws (1:UserContextException ucx),
        bool addIpAdressForUser(1:string ip, 2:i64 timestamp, 3:i64 userId)throws (1:UserContextException ucx),
        bool addAddressForUser(1:TAddress address, 2:i64 userid, 3:i64 timestamp)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 updatePassword(1:i64 userid, 2:string password)throws (1:UserContextException ucx),
        bool deleteUser(1:i64 userid)throws (1:UserContextException ucx),
        bool sendEmailVerification(1:i64 userid)throws (1:UserContextException ucx),
        bool sendSMSVerification(1:i64 userid)throws (1:UserContextException ucx),
        bool confirmEmailVerification(1:i64 userid)throws (1:UserContextException ucx),
        bool confirmSMSVerification(1:i64 userid)throws (1:UserContextException ucx),
        bool addSocialhandle(1:i64 userid, 2:string socialService, 3:string handle)throws (1:UserContextException ucx)          
}