Advertisement
diegographics

Untitled

Mar 15th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.89 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class WordpressCore : MonoBehaviour
  5. {
  6.    
  7.  
  8.    
  9.     public class wordpress_api
  10.     {
  11.  
  12.         //Privates
  13.         private string url;
  14.         private bool premium;
  15.         public delegate void ResponseHandler(string responseContent);
  16.         IEnumerator AskServerSomething(string request_url, ResponseHandler onSuccess, ResponseHandler onFail)
  17.         {
  18.             WWW www = new WWW(url + request_url);
  19.             yield return www;
  20.             if (www.error == null)
  21.             {
  22.                 print("success: " + www.text);
  23.  
  24.             }
  25.             else
  26.             {
  27.                 print("something wrong: " + www.text);
  28.  
  29.             }
  30.         }
  31.  
  32.  
  33.         public enum Controller
  34.         {
  35.             Core,
  36.             Posts,
  37.             Respond,
  38.             Widgets,
  39.             UserPlus
  40.         }
  41.         public enum Method
  42.         {
  43.             __construct,
  44.             email_exists,
  45.             username_exists,
  46.             register,
  47.             get_avatar,
  48.             get_userinfo,
  49.             retrieve_password,
  50.             validate_auth_cookie,
  51.             generate_auth_cookie,
  52.             get_currentuserinfo,
  53.             get_user_meta,
  54.             update_user_meta,
  55.             delete_user_meta,
  56.             xprofile,
  57.             xprofile_update,
  58.             fb_connect,
  59.             post_comment,
  60.             profile,
  61.             friends,
  62.             threads,
  63.             thread,
  64.             new_message,
  65.             mark_thread_read,
  66.             mark_thread_unread,
  67.             messages_count,
  68.             avatar_upload,
  69.             delete_account,
  70.             get_sidebar,
  71.             submit_comment,
  72.             create_post,
  73.             update_post,
  74.             delete_post,
  75.             info,
  76.             get_recent_posts,
  77.             get_posts,
  78.             get_post,
  79.             get_page,
  80.             get_date_posts,
  81.             get_category_posts,
  82.             get_tag_posts,
  83.             get_author_posts,
  84.             get_search_results,
  85.             get_date_index,
  86.             get_category_index,
  87.             get_tag_index,
  88.             get_author_index,
  89.             get_page_index,
  90.             get_nonce
  91.         }
  92.  
  93.         public void Initialize(string set_url, bool set_premium)
  94.         {
  95.             url = set_url;
  96.             premium = set_premium;
  97.             Debug.Log("SetUrl: " + url + " Set_Premium: " + set_premium.ToString());
  98.            
  99.         }
  100.        
  101.         public string GetNonce(Controller SetController, Method SetMethod)
  102.         {
  103.             AskServerSomething("get_nonce/?controller=" + SetController + "&method=" + SetMethod, new ResponseHandler(GetNonce_Succes), new ResponseHandler(GetNonce_Fail));
  104.  
  105.         }
  106.         private void GetNonce_Succes()
  107.         {
  108.  
  109.         }
  110.         private void GetNonce_Fail()
  111.         {
  112.  
  113.         }
  114.  
  115.     }
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement