Beispiel #1
0
        public static Session DirectLogin(String p_User, String p_Password, Int32 p_Nid)
        {
            MethodCall mc = Toco.GetLoginMethodCall(p_User, p_Password, p_Nid);
            // replace later with properties
            Call           c  = new Call("http://www.tocorre.com/ext/rpc/rpc_api.php", mc);
            MethodResponse mr = c.Execute();

            return(Session.FromValue(mr.values[0]));
        }
Beispiel #2
0
        public static void DirectProfile(Int32 p_Nid)
        {
            // prepare call
            MethodCall mc = Toco.GetProfileMethodCall(p_Nid);

            // replace later with properties
            Call c = new Call("http://www.tocorre.com/ext/rpc/rpc_api.php", mc);

            MethodResponse mr = c.Execute();

            Console.WriteLine(mr.ToString());
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Toco t = new Toco();

            t.Login("tu_email@de_tocorre.com", "tu_password");
            t.Profile();
            t.Scraps(0, 0, 0, 0, 3);
            t.Msg(0, 0, 0, 0, 0, 0);
            t.SetMotd(0, "--- Venga Emma! Venga Rafael! --- (seteado desde el glorioso TOCOAPI)");
            List <Tocobject> l = t.ExecuteSystemMultiCall();

            Session      session = (Session)l[0];
            GenericValue profile = (GenericValue)l[1];
            Scrap        scrap   = (Scrap)l[2];
            Msgs         msgs    = (Msgs)l[3];
            GenericValue motd    = (GenericValue)l[4];

            if (!session.fault)
            {
                Console.WriteLine("Got session id: " + session.sid_id);
            }
            else
            {
                Console.WriteLine("Error! - Couldn't get session. Check your username and password -> Server said: " + session.fault_value.struct_value["faultString"].string_value);
            }

            if (!msgs.fault)
            {
                Console.WriteLine("Got " + msgs.entries.Count + " messages");
                Console.WriteLine("----");
                foreach (Msg m in msgs.entries.Values)
                {
                    Console.WriteLine("MsgId: " + m.msg_id);
                    Console.WriteLine(m.text);
                }
                Console.WriteLine("----");
            }

            Console.Read();
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            Toco t = new Toco();

            t.Login("tu_email@de_tocorre.com", "tu_password");
            t.Profile();
            t.Scraps(0, 0, 0, 0, 3);
            t.Msg(0, 0, 0, 0, 0, 0);
            t.SetMotd(0, "--- Venga Emma! Venga Rafael! --- (seteado desde el glorioso TOCOAPI)");
            List<Tocobject> l = t.ExecuteSystemMultiCall();

            Session session = (Session)l[0];
            GenericValue profile = (GenericValue)l[1];
            Scrap scrap = (Scrap)l[2];
            Msgs msgs = (Msgs)l[3];
            GenericValue motd = (GenericValue)l[4];

            if (!session.fault)
                Console.WriteLine("Got session id: " + session.sid_id);
            else
                Console.WriteLine("Error! - Couldn't get session. Check your username and password -> Server said: " + session.fault_value.struct_value["faultString"].string_value);

            if (!msgs.fault)
            {
                Console.WriteLine("Got " + msgs.entries.Count + " messages");
                Console.WriteLine("----");
                foreach (Msg m in msgs.entries.Values)
                {
                    Console.WriteLine("MsgId: " + m.msg_id);
                    Console.WriteLine(m.text);
                }
                Console.WriteLine("----");
            }

            Console.Read();
        }
Beispiel #5
0
 public static Session DirectLogin(String p_User, String p_Password)
 {
     return(Toco.DirectLogin(p_User, p_Password, 0));
 }
Beispiel #6
0
        public void SetMotd(Int32 p_Required, String p_Motd)
        {
            MethodCall mc = Toco.GetSetMotdMethodCall(p_Required, p_Motd);

            this.AddMethodCall(mc);
        }
Beispiel #7
0
        // Flush API function
        public void Flush(Int32 p_Required)
        {
            MethodCall mc = Toco.GetFlushMethodCall(p_Required);

            this.AddMethodCall(mc);
        }
Beispiel #8
0
        // Msg API function
        public void Msg(Int32 p_Nid, Int32 p_UnixTimeStamp, Int32 p_MsgId, Int32 p_Offset, Int32 p_Qty, Int32 p_Folder)
        {
            MethodCall mc = Toco.GetMsgMethodCall(p_Nid, p_UnixTimeStamp, p_MsgId, p_Offset, p_Qty, p_Folder);

            this.AddMethodCall(mc);
        }
Beispiel #9
0
        // Scraps API function
        public void Scraps(Int32 p_Nid, Int32 p_UnixTimeStamp, Int32 p_NoteId, Int32 p_Offset, Int32 p_Qty)
        {
            MethodCall mc = Toco.GetScrapsMethodCall(p_Nid, p_UnixTimeStamp, p_NoteId, p_Offset, p_Qty);

            this.AddMethodCall(mc);
        }
Beispiel #10
0
        public void Profile(Int32 p_Nid)
        {
            MethodCall mc = Toco.GetProfileMethodCall(p_Nid);

            this.AddMethodCall(mc);
        }
Beispiel #11
0
        public void Login(String p_User, String p_Password, Int32 p_Nid)
        {
            MethodCall mc = Toco.GetLoginMethodCall(p_User, p_Password, p_Nid);

            this.AddMethodCall(mc);
        }