Ejemplo n.º 1
0
 /// <summary>
 /// Post a object to remote.
 /// </summary>
 /// <param name="endpoint">The api endpoint.</param>
 /// <param name="obj">The object to be posted.</param>
 public void PostAsync(string endpoint, object obj)
 {
     new Thread(delegate()
     {
         try
         {
             this.Post(endpoint, RockJsonSerializer.Serialize(obj));
         }
         catch (Exception e)
         {
             // for any exception
             Console.WriteLine(e);
         }
     }).Start();
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Post a object to remote and without getting the result.
 /// </summary>
 /// <param name="endpoint">The api endpoint.</param>
 /// <param name="obj">The object to be posted.</param>
 public void Post(string endpoint, object obj)
 {
     this.Post(endpoint, RockJsonSerializer.Serialize(obj));
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Post a object to remote and get the result.
        /// </summary>
        /// <typeparam name="T">Return Type.</typeparam>
        /// <param name="endpoint">The api endpoint.</param>
        /// <param name="obj">The object to be posted.</param>
        /// <returns>The return object.</returns>
        public T Post <T>(string endpoint, object obj)
        {
            var ret = this.Post(endpoint, RockJsonSerializer.Serialize(obj));

            return(RockJsonSerializer.Deserialize <T>(ret));
        }