public List <InboundConnectionRequest> getConnections(String status, List <long> userIds)
        {
            Boolean       userList   = false;
            StringBuilder userIdList = new StringBuilder();

            if (userIds != null)
            {
                if (userIds.Count != 0)
                {
                    userList = true;
                    userIdList.Append(userIds[0]);
                    for (int i = 1; i < userIds.Count; i++)
                    {
                        userIdList.Append("," + userIds[i]);
                    }
                }
            }

            SymConfig          symConfig          = botClient.getConfig();
            RestRequestHandler restRequestHandler = CreateRestRequestHandler();
            string             url = CommonConstants.HTTPSPREFIX + symConfig.podHost + ":" + symConfig.podPort + PodConstants.GETCONNECTIONS;


            if (status != null)
            {
                if (url.Contains("?"))
                {
                    url = url + "&status=" + status;
                }
                else
                {
                    url = url + "?status=" + status;
                }
            }
            if (userList)
            {
                if (url.Contains("?"))
                {
                    url = url + "&userIds=" + userIdList.ToString();
                }
                else
                {
                    url = url + "?userIds=" + userIdList.ToString();
                }
            }
            HttpWebResponse resp = restRequestHandler.executeRequest(null, url, false, WebRequestMethods.Http.Get, symConfig, true);
            string          body = restRequestHandler.ReadResponse(resp);

            resp.Close();
            return(JsonConvert.DeserializeObject <InboundConnectionRequestList>(body));
        }
        public InboundConnectionRequest acceptConnectionRequest(long userId)
        {
            UserId userIdObject = new UserId();

            userIdObject.setUserId(userId);
            SymConfig          symConfig          = botClient.getConfig();
            RestRequestHandler restRequestHandler = CreateRestRequestHandler();
            string             url  = CommonConstants.HTTPSPREFIX + symConfig.podHost + ":" + symConfig.podPort + PodConstants.ACCEPTCONNECTION;
            HttpWebResponse    resp = restRequestHandler.executeRequest(userIdObject, url, false, WebRequestMethods.Http.Post, symConfig, true);
            string             body = restRequestHandler.ReadResponse(resp);

            resp.Close();
            return(JsonConvert.DeserializeObject <InboundConnectionRequest>(body));
        }
        public Signal updateSignal(Signal signal)
        {
            Signal             result             = new Signal();
            SymConfig          symConfig          = botClient.getConfig();
            RestRequestHandler restRequestHandler = new RestRequestHandler();
            string             url  = CommonConstants.HTTPSPREFIX + symConfig.agentHost + ":" + symConfig.agentPort + AgentConstants.UPDATESIGNAL.Replace("{id}", signal.id);
            HttpWebResponse    resp = restRequestHandler.executeRequest(signal, url, false, WebRequestMethods.Http.Post, symConfig, true);
            string             body = restRequestHandler.ReadResponse(resp);

            resp.Close();
            result = JsonConvert.DeserializeObject <Signal>(body);

            return(result);
        }
        public void kmAuthenticate()
        {
            Dictionary <String, String> token = new Dictionary <string, string>();

            token.Add("token", jwt);
            RestRequestHandler restRequestHandler = new RestRequestHandler();
            string             url  = "https://" + symConfig.sessionAuthHost + ":" + symConfig.sessionAuthPort + AuthEndpointConstants.RSAKMAUTH;
            HttpWebResponse    resp = restRequestHandler.executeRequest(token, url, true, WebRequestMethods.Http.Post, symConfig, false);
            string             body = restRequestHandler.ReadResponse(resp);
            JObject            o    = JObject.Parse(body);

            authTokens.keyManagerToken = (string)o["token"];
            kmToken = authTokens.keyManagerToken;
        }
        public UserPresence setPresence(String status)
        {
            Category category = new Category();

            category.setCategory(status);
            SymConfig          symConfig          = botClient.getConfig();
            RestRequestHandler restRequestHandler = new RestRequestHandler();
            string             url  = CommonConstants.HTTPSPREFIX + symConfig.podHost + ":" + symConfig.podPort + PodConstants.SETPRESENCE;
            HttpWebResponse    resp = restRequestHandler.executeRequest(category, url, false, WebRequestMethods.Http.Post, symConfig, true);
            string             body = restRequestHandler.ReadResponse(resp);

            resp.Close();
            return(JsonConvert.DeserializeObject <UserPresence>(body));
        }
Exemplo n.º 6
0
        public void sessionAppAuthenticate()
        {
            RestRequestHandler restRequestHandler = new RestRequestHandler();
            string             url  = "https://" + symConfig.sessionAuthHost + ":" + symConfig.sessionAuthPort + AuthEndpointConstants.SESSIONAPPAUTH;
            HttpWebResponse    resp = restRequestHandler.executeRequest(null, url, true, WebRequestMethods.Http.Post, symConfig, false);
            string             body = restRequestHandler.ReadResponse(resp);

            resp.Close();
            JObject o = JObject.Parse(body);

            authTokens.sessionToken = (string)o["token"];
            sessionToken            = authTokens.sessionToken;
            symConfig.authTokens    = authTokens;
        }
Exemplo n.º 7
0
        public Datafeed createDatafeed(SymConfig symConfig)
        {
            Datafeed           datafeed           = new Datafeed();
            RestRequestHandler restRequestHandler = new RestRequestHandler();
            string             url  = "https://" + symConfig.agentHost + ":" + symConfig.agentPort + "/agent/v4/datafeed/create";
            HttpWebResponse    resp = restRequestHandler.executeRequest(null, url, false, WebRequestMethods.Http.Post, symConfig, true);
            string             body = restRequestHandler.ReadResponse(resp);

            resp.Close();
            JObject o = JObject.Parse(body);

            datafeed.datafeedID = (string)o["id"];
            return(datafeed);
        }
        public MessageStatus getMessageStatus(String messageId)
        {
            SymConfig symConfig = botClient.getConfig();

            RestRequestHandler restRequestHandler = new RestRequestHandler();
            string             url = CommonConstants.HTTPSPREFIX + symConfig.agentHost + ":" + symConfig.agentPort + PodConstants.GETMESSAGESTATUS.Replace("{mid}", messageId);

            HttpWebResponse resp = restRequestHandler.executeRequest(null, url, false, WebRequestMethods.Http.Get, symConfig, true);
            string          body = restRequestHandler.ReadResponse(resp);

            resp.Close();
            MessageStatus messageStatus = JsonConvert.DeserializeObject <MessageStatus>(body);

            return(messageStatus);
        }
        public byte[] getAttachment(String streamId, String attachmentId, String messageId)
        {
            SymConfig symConfig = botClient.getConfig();

            RestRequestHandler restRequestHandler = new RestRequestHandler();
            string             url = CommonConstants.HTTPSPREFIX + symConfig.agentHost + ":" + symConfig.agentPort + AgentConstants.GETATTACHMENT.Replace("{sid}", streamId) + "?filedId=" + attachmentId + "&messageId=" + messageId;

            HttpWebResponse resp = restRequestHandler.executeRequest(null, url, false, WebRequestMethods.Http.Get, symConfig, true);
            string          body = restRequestHandler.ReadResponse(resp);

            resp.Close();
            var base64EncodedBytes = System.Convert.FromBase64String(body);

            return(base64EncodedBytes);
        }
Exemplo n.º 10
0
        public InboundMessage sendMessage(String streamId, OutboundMessage message, Boolean appendTags)
        {
            SymConfig          symConfig          = botClient.getConfig();
            RestRequestHandler restRequestHandler = new RestRequestHandler();
            string             url = "https://" + symConfig.agentHost + ":" + symConfig.agentPort + "/agent/v4/stream/" + streamId + "/message/create";

            if (botClient is SymOBOClient)
            {
                symConfig.authTokens.sessionToken = botClient.getSymAuth().getSessionToken();
            }
            HttpResponseMessage resp           = restRequestHandler.executePostFormRequest(message, url, symConfig);
            InboundMessage      inboundMessage = JsonConvert.DeserializeObject <InboundMessage>(resp.Content.ReadAsStringAsync().Result);

            return(inboundMessage);
        }
        public UserInfo getSessionUser()
        {
            SymConfig          symConfig          = botClient.getConfig();
            UserInfo           info               = null;
            RestRequestHandler restRequestHandler = new RestRequestHandler();
            string             url  = CommonConstants.HTTPSPREFIX + symConfig.podHost + ":" + symConfig.podPort + PodConstants.GETSESSIONUSER;
            HttpWebResponse    resp = restRequestHandler.executeRequest(null, url, false, WebRequestMethods.Http.Get, symConfig, false);

            if (resp.StatusCode == HttpStatusCode.OK)
            {
                string body = restRequestHandler.ReadResponse(resp);
                info = JsonConvert.DeserializeObject <UserInfo>(body);
            }
            resp.Close();
            return(info);
        }
Exemplo n.º 12
0
        public void AddRequestHandler(string url, RestMethod method, RestRequestHandler handler)
        {
            var digestibleUrl = new RestDigestibleUri(url);

            foreach (var node in m_handlerNodes)
            {
                if (node.MatchesUriPattern(digestibleUrl))
                {
                    node.AddRestRequestHandler(digestibleUrl, method, handler);
                    return;
                }
            }

            var newNode = new NamedUriRequestHandlerNode(digestibleUrl, method, handler);

            m_handlerNodes.Add(newNode);
        }
Exemplo n.º 13
0
        public void removeMemberFromRoom(String streamId, long userId)
        {
            SymConfig symConfig = botClient.getConfig();
            NumericId id        = new NumericId();

            id.id = userId;
            RestRequestHandler restRequestHandler = new RestRequestHandler();
            string             url  = CommonConstants.HTTPSPREFIX + symConfig.podHost + ":" + symConfig.podPort + PodConstants.REMOVEMEMBER.Replace("{id}", streamId);
            HttpWebResponse    resp = restRequestHandler.executeRequest(null, url, false, WebRequestMethods.Http.Post, symConfig, true);

            if (resp.StatusCode == HttpStatusCode.NoContent)
            {
                throw new Exception("No user found.");
            }
            else if (resp.StatusCode == HttpStatusCode.OK)
            {
                string body = restRequestHandler.ReadResponse(resp);
            }
        }
Exemplo n.º 14
0
        //TODO: CHECK WHY 500
        public RoomSearchResult searchRooms(RoomSearchQuery query, int skip, int limit)
        {
            RoomSearchResult result    = null;
            SymConfig        symConfig = botClient.getConfig();

            RestRequestHandler restRequestHandler = new RestRequestHandler();
            string             url = CommonConstants.HTTPSPREFIX + symConfig.podHost + ":" + symConfig.podPort + PodConstants.SEARCHROOMS;


            if (skip > 0)
            {
                if (url.Contains("?"))
                {
                    url = url + "&skip=" + skip;
                }
                else
                {
                    url = url + "?skip=" + skip;
                }
            }
            if (limit > 0)
            {
                if (url.Contains("?"))
                {
                    url = url + "&limit=" + limit;
                }
                else
                {
                    url = url + "?limit=" + limit;
                }
            }
            if (query.labels == null)
            {
                query.labels = new List <String>();
            }
            HttpWebResponse resp = restRequestHandler.executeRequest(query, url, false, WebRequestMethods.Http.Post, symConfig, true);
            string          body = restRequestHandler.ReadResponse(resp);

            result = JsonConvert.DeserializeObject <RoomSearchResult>(body);

            return(result);
        }
Exemplo n.º 15
0
        public RoomInfo createRoom(Room room)
        {
            SymConfig          symConfig          = botClient.getConfig();
            RoomInfo           roomInfo           = new RoomInfo();
            RestRequestHandler restRequestHandler = new RestRequestHandler();
            string             url  = CommonConstants.HTTPSPREFIX + symConfig.podHost + ":" + symConfig.podPort + PodConstants.CREATEROOM;
            HttpWebResponse    resp = restRequestHandler.executeRequest(room, url, false, WebRequestMethods.Http.Post, symConfig, true);

            if (resp.StatusCode == HttpStatusCode.NoContent)
            {
                throw new Exception("No user found.");
            }
            else if (resp.StatusCode == HttpStatusCode.OK)
            {
                string body = restRequestHandler.ReadResponse(resp);
                roomInfo = JsonConvert.DeserializeObject <RoomInfo>(body);
            }

            return(roomInfo);
        }
Exemplo n.º 16
0
        public String getUserListIM(List <long> userIdList)
        {
            SymConfig          symConfig          = botClient.getConfig();
            StringId           id                 = new StringId();
            RestRequestHandler restRequestHandler = new RestRequestHandler();
            string             url                = CommonConstants.HTTPSPREFIX + symConfig.podHost + ":" + symConfig.podPort + PodConstants.GETIM;
            HttpWebResponse    resp               = restRequestHandler.executeRequest(userIdList, url, false, WebRequestMethods.Http.Post, symConfig, true);

            if (resp.StatusCode == HttpStatusCode.NoContent)
            {
                throw new Exception("No user found.");
            }
            else if (resp.StatusCode == HttpStatusCode.OK)
            {
                string body = restRequestHandler.ReadResponse(resp);
                id = JsonConvert.DeserializeObject <StringId>(body);
            }

            return(id.id);
        }
Exemplo n.º 17
0
        //TODO: CHECK WHY 404
        public StreamInfo getStreamInfo(String streamId)
        {
            SymConfig          symConfig          = botClient.getConfig();
            StreamInfo         streamInfo         = new StreamInfo();
            RestRequestHandler restRequestHandler = new RestRequestHandler();
            string             url  = CommonConstants.HTTPSPREFIX + symConfig.podHost + ":" + symConfig.podPort + PodConstants.GETSTREAMINFO.Replace("{id}", streamId);
            HttpWebResponse    resp = restRequestHandler.executeRequest(null, url, false, WebRequestMethods.Http.Get, symConfig, true);

            if (resp.StatusCode == HttpStatusCode.NoContent)
            {
                throw new Exception("No stream found.");
            }
            else if (resp.StatusCode == HttpStatusCode.OK)
            {
                string body = restRequestHandler.ReadResponse(resp);

                streamInfo = JsonConvert.DeserializeObject <StreamInfo>(body);
            }
            return(streamInfo);
        }
        public UserInfo getUserFromEmail(String email, Boolean local)
        {
            SymConfig          symConfig          = botClient.getConfig();
            UserInfo           info               = null;
            RestRequestHandler restRequestHandler = new RestRequestHandler();
            string             url  = CommonConstants.HTTPSPREFIX + symConfig.podHost + ":" + symConfig.podPort + PodConstants.GETUSERSV3 + "?email=" + email + "&local=" + local;
            HttpWebResponse    resp = restRequestHandler.executeRequest(null, url, false, WebRequestMethods.Http.Get, symConfig, true);

            if (resp.StatusCode == HttpStatusCode.NoContent)
            {
                throw new Exception("No user found.");
            }
            else if (resp.StatusCode == HttpStatusCode.OK)
            {
                string body = restRequestHandler.ReadResponse(resp);
                info = JsonConvert.DeserializeObject <UserInfo>(body);
            }

            return(info);
        }
        public SignalSubscriptionResult subscribeSignal(String id, Boolean self, List<long> uids, Boolean pushed)
        {

            SymConfig symConfig = botClient.getConfig();
            RestRequestHandler restRequestHandler = new RestRequestHandler();
            HttpWebResponse resp;
            if (self) {
                string url = CommonConstants.HTTPSPREFIX + symConfig.agentHost + ":" + symConfig.agentPort + AgentConstants.SUBSCRIBESIGNAL.Replace("{id}", id);
                resp = restRequestHandler.executeRequest(null, url, false, WebRequestMethods.Http.Post, symConfig, true);
                
             } else {

                string url = CommonConstants.HTTPSPREFIX + symConfig.agentHost + ":" + symConfig.agentPort + AgentConstants.SUBSCRIBESIGNAL.Replace("{id}", id) + "?pushed=" + pushed;
                resp = restRequestHandler.executeRequest(uids, url, false, WebRequestMethods.Http.Post, symConfig, true);
                
            }

            string body = restRequestHandler.ReadResponse(resp);
            return JsonConvert.DeserializeObject<SignalSubscriptionResult>(body);
        }
Exemplo n.º 20
0
        public RoomInfo updateRoom(String streamId, Room room)
        {
            SymConfig          symConfig          = botClient.getConfig();
            RoomInfo           roomInfo           = new RoomInfo();
            RestRequestHandler restRequestHandler = new RestRequestHandler();
            string             url  = CommonConstants.HTTPSPREFIX + symConfig.podHost + ":" + symConfig.podPort + PodConstants.UPDATEROOMINFO.Replace("{id}", streamId);
            HttpWebResponse    resp = restRequestHandler.executeRequest(room, url, false, WebRequestMethods.Http.Post, symConfig, true);

            //.post(Entity.entity(room, MediaType.APPLICATION_JSON));
            if (resp.StatusCode == HttpStatusCode.NoContent)
            {
                throw new Exception("No user found.");
            }
            else if (resp.StatusCode == HttpStatusCode.OK)
            {
                string body = restRequestHandler.ReadResponse(resp);

                roomInfo = JsonConvert.DeserializeObject <RoomInfo>(body);
            }
            return(roomInfo);
        }
Exemplo n.º 21
0
        public List <RoomMember> getRoomMembers(String streamId)
        {
            SymConfig          symConfig          = botClient.getConfig();
            List <RoomMember>  roomMembers        = new List <RoomMember>();
            RestRequestHandler restRequestHandler = new RestRequestHandler();
            string             url  = CommonConstants.HTTPSPREFIX + symConfig.podHost + ":" + symConfig.podPort + PodConstants.GETROOMMEMBERS.Replace("{id}", streamId);
            HttpWebResponse    resp = restRequestHandler.executeRequest(null, url, false, WebRequestMethods.Http.Get, symConfig, true);

            if (resp.StatusCode == HttpStatusCode.NoContent)
            {
                throw new Exception("No stream found.");
            }
            else if (resp.StatusCode == HttpStatusCode.OK)
            {
                string body = restRequestHandler.ReadResponse(resp);

                roomMembers = JsonConvert.DeserializeObject <List <RoomMember> >(body);
            }

            return(roomMembers);
        }
        public List <Signal> listSignals(int skip, int limit)
        {
            List <Signal>      result             = new List <Signal>();
            SymConfig          symConfig          = botClient.getConfig();
            RestRequestHandler restRequestHandler = new RestRequestHandler();
            string             url = CommonConstants.HTTPSPREFIX + symConfig.agentHost + ":" + symConfig.agentPort + AgentConstants.LISTSIGNALS;


            if (skip > 0)
            {
                if (url.Contains("?"))
                {
                    url = url + "&skip=" + skip;
                }
                else
                {
                    url = url + "?skip=" + skip;
                }
            }
            if (limit > 0)
            {
                if (url.Contains("?"))
                {
                    url = url + "&limit=" + limit;
                }
                else
                {
                    url = url + "?limit=" + limit;
                }
            }
            HttpWebResponse resp = restRequestHandler.executeRequest(null, url, false, WebRequestMethods.Http.Get, symConfig, true);
            string          body = restRequestHandler.ReadResponse(resp);

            resp.Close();
            result = JsonConvert.DeserializeObject <List <Signal> >(body);

            return(result);
        }
Exemplo n.º 23
0
 public void sessionAuthenticate()
 {
     if (uid != 0)
     {
         RestRequestHandler restRequestHandler = new RestRequestHandler();
         string             url  = "https://" + config.sessionAuthHost + ":" + config.sessionAuthPort + AuthEndpointConstants.OBOUSERAUTH.Replace("{uid}", uid.ToString());
         HttpWebResponse    resp = restRequestHandler.executeRequest(null, url, true, WebRequestMethods.Http.Post, config, false);
         string             body = restRequestHandler.ReadResponse(resp);
         JObject            o    = JObject.Parse(body);
         authTokens.sessionToken = (string)o["sessionToken"];
         sessionToken            = authTokens.sessionToken;
     }
     else
     {
         RestRequestHandler restRequestHandler = new RestRequestHandler();
         string             url  = "https://" + config.sessionAuthHost + ":" + config.sessionAuthPort + AuthEndpointConstants.OBOUSERAUTHUSERNAME.Replace("{username}", username);
         HttpWebResponse    resp = restRequestHandler.executeRequest(null, url, true, WebRequestMethods.Http.Post, config, false);
         string             body = restRequestHandler.ReadResponse(resp);
         JObject            o    = JObject.Parse(body);
         authTokens.sessionToken = (string)o["sessionToken"];
         sessionToken            = authTokens.sessionToken;
     }
 }
        public SignalSubscriberList getSignalSubscribers(String id, int skip, int limit)
        {
            SymConfig          symConfig          = botClient.getConfig();
            RestRequestHandler restRequestHandler = new RestRequestHandler();
            string             url = CommonConstants.HTTPSPREFIX + symConfig.agentHost + ":" + symConfig.agentPort + AgentConstants.GETSUBSCRIBERS.Replace("{id}", id);

            if (skip > 0)
            {
                if (url.Contains("?"))
                {
                    url = url + "&skip=" + skip;
                }
                else
                {
                    url = url + "?skip=" + skip;
                }
            }
            if (limit > 0)
            {
                if (url.Contains("?"))
                {
                    url = url + "&limit=" + limit;
                }
                else
                {
                    url = url + "?limit=" + limit;
                }
            }


            HttpWebResponse resp = restRequestHandler.executeRequest(null, url, false, WebRequestMethods.Http.Get, symConfig, true);
            string          body = restRequestHandler.ReadResponse(resp);

            resp.Close();
            return(JsonConvert.DeserializeObject <SignalSubscriberList>(body));
        }
Exemplo n.º 25
0
        public List <InboundMessage> getMessagesFromStream(String streamId, int since, int skip, int limit)
        {
            List <InboundMessage> result    = null;
            SymConfig             symConfig = botClient.getConfig();

            RestRequestHandler restRequestHandler = new RestRequestHandler();
            string             getMessageUrl      = AgentConstants.GETMESSAGES.Replace("{sid}", streamId);
            string             url = CommonConstants.HTTPSPREFIX + symConfig.agentHost + ":" + symConfig.agentPort + getMessageUrl + "?since=" + since.ToString();


            if (skip > 0)
            {
                url = url + "&skip=" + skip;
            }
            if (limit > 0)
            {
                url = url + "&limit=" + limit;
            }
            HttpWebResponse       resp            = restRequestHandler.executeRequest(null, url, false, WebRequestMethods.Http.Get, symConfig, true);
            string                body            = restRequestHandler.ReadResponse(resp);
            List <InboundMessage> inboundMessages = JsonConvert.DeserializeObject <List <InboundMessage> >(body);

            return(inboundMessages);
        }
        public ParameterUriRequestHandlerNode(RestDigestibleUri uri, RestMethod method, RestRequestHandler handler)
        {
            m_parameterPattern = uri.GetCurrentNode();
            m_parameterName    = m_parameterPattern.Replace("]", string.Empty).Replace("[", string.Empty);

            AddRestRequestHandler(uri, method, handler);
        }
        public UserSearchResult searchUsers(String query, Boolean local, int skip, int limit, UserFilter filter)
        {
            UserSearchResult result    = null;
            SymConfig        symConfig = botClient.getConfig();

            RestRequestHandler restRequestHandler = new RestRequestHandler();
            string             url = CommonConstants.HTTPSPREFIX + symConfig.podHost + ":" + symConfig.podPort + PodConstants.SEARCHUSERS;


            if (skip > 0)
            {
                if (url.Contains("?"))
                {
                    url = url + "&skip=" + skip;
                }
                else
                {
                    url = url + "?skip=" + skip;
                }
            }
            if (limit > 0)
            {
                if (url.Contains("?"))
                {
                    url = url + "&limit=" + limit;
                }
                else
                {
                    url = url + "?limit=" + limit;
                }
            }
            if (local)
            {
                if (url.Contains("?"))
                {
                    url = url + "&local=" + local;
                }
                else
                {
                    url = url + "?local=" + local;
                }
            }
            Dictionary <String, Object> body = new Dictionary <String, Object>();

            body.Add("query", query);
            body.Add("filters", filter);

            HttpWebResponse resp = restRequestHandler.executeRequest(null, url, false, WebRequestMethods.Http.Post, symConfig, true);

            if (resp.StatusCode == HttpStatusCode.NoContent)
            {
                resp.Close();
                throw new Exception("No user found.");
            }
            else if (resp.StatusCode == HttpStatusCode.OK)
            {
                string resbody = restRequestHandler.ReadResponse(resp);
                result = JsonConvert.DeserializeObject <UserSearchResult>(resbody);
            }
            resp.Close();
            return(result);
        }
        public List <UserInfo> getUsersV3(List <String> emailList, List <long> idList, Boolean local)
        {
            SymConfig       symConfig        = botClient.getConfig();
            List <UserInfo> infoList         = new List <UserInfo>();
            Boolean         emailBased       = false;
            StringBuilder   lookUpListString = new StringBuilder();

            if (emailList != null)
            {
                if (emailList.Count == 0)
                {
                    throw new Exception("No user sent for lookup");
                }
                emailBased = true;
                lookUpListString.Append(emailList[0]);
                for (int i = 1; i < emailList.Count; i++)
                {
                    lookUpListString.Append("," + emailList[i]);
                }
            }

            else if (idList != null)
            {
                if (idList.Count == 0)
                {
                    throw new Exception("No user sent for lookup");
                }
                lookUpListString.Append(idList[0]);
                for (int i = 1; i < idList.Count; i++)
                {
                    lookUpListString.Append("," + idList[i]);
                }
            }
            else
            {
                throw new Exception("No user sent for lookup");
            }

            RestRequestHandler restRequestHandler = new RestRequestHandler();
            string             url = CommonConstants.HTTPSPREFIX + symConfig.podHost + ":" + symConfig.podPort + PodConstants.GETUSERSV3;

            if (emailBased)
            {
                url = url + "?email=" + lookUpListString.ToString();
            }
            else
            {
                url = url + "?uid=" + lookUpListString.ToString();
            }
            url = url + "&local=" + local;
            HttpWebResponse resp = restRequestHandler.executeRequest(null, url, false, WebRequestMethods.Http.Get, symConfig, true);

            if (resp.StatusCode == HttpStatusCode.NoContent)
            {
                resp.Close();
                throw new Exception("No user found.");
            }
            else if (resp.StatusCode == HttpStatusCode.OK)
            {
                string body = restRequestHandler.ReadResponse(resp);
                infoList = JsonConvert.DeserializeObject <List <UserInfo> >(body);
            }
            resp.Close();
            return(infoList);
        }
Exemplo n.º 29
0
        public NamedUriRequestHandlerNode(RestDigestibleUri uri, RestMethod method, RestRequestHandler handler)
        {
            m_nodeName = uri.GetCurrentNode();

            AddRestRequestHandler(uri, method, handler);
        }
 public WildCardUriRequestHandlerNode(RestDigestibleUri uri, RestMethod method, RestRequestHandler handler)
 {
     AddRestRequestHandler(uri, method, handler);
 }