// This is the main entry point of the application.
        static void Main(string[] args)
        {
            /* Demo
             *
             * Send SMS and Subscribe
             *
             */
            var appKey = "MyAppKey";
            var appSecret = "MyAppSecret";
            var serverUrl = "https://platform.devtest.ringcentral.com";
            var username = "******";
            var extension = "101";
            var password = "******";

            var sdk = new SDK(appKey, appSecret, serverUrl, "appName", "appVersion");
            ApiResponse response = sdk.Platform.Authorize(username, extension, password, true);

            String jsonSmsString = "{\"from\":{\"phoneNumber\":\"1650111222\"},\"to\":[{\"phoneNumber\":\"+1650111333\"}],\"text\":\"Hello iOS\"}";
            Request request = new Request("/restapi/v1.0/account/~/extension/~/sms", jsonSmsString);
            ApiResponse response2 = sdk.Platform.Post(request);

            var subscription = new RingCentral.Subscription.SubscriptionServiceImplementation(){ _platform = sdk.Platform};
            subscription.AddEvent("/restapi/v1.0/account/~/extension/~/presence");
            subscription.AddEvent("/restapi/v1.0/account/~/extension/~/message-store");
            ApiResponse response3 = subscription.Subscribe(ios100.Application.Action, Action, Action);

            Console.WriteLine (response3.ToString ());

            // if you want to use a different Application Delegate class from "AppDelegate"
            // you can specify it here.
            UIApplication.Main (args, null, "AppDelegate");
        }
        public static void Main(string[] args)
        {
            var appKey = "MyAppKey";
            var appSecret = "MyAppSecret";
            var serverUrl = "https://platform.devtest.ringcentral.com";
            var username = "******";
            var extension = "101";
            var password = "******";

            var sdk = new SDK(appKey, appSecret, serverUrl, "appName", "appVersion");
            ApiResponse response = sdk.Platform.Authorize(username, extension, password, true);

            String jsonSmsString = "{\"from\":{\"phoneNumber\":\"1650111222\"},\"to\":[{\"phoneNumber\":\"+1650111333\"}],\"text\":\"Hello Mac\"}";
            Request request = new Request("/restapi/v1.0/account/~/extension/~/sms", jsonSmsString);
            ApiResponse response2 = sdk.Platform.Post(request);

            var subscription = new RingCentral.Subscription.SubscriptionServiceImplementation(){ _platform = sdk.Platform};
            subscription.AddEvent("/restapi/v1.0/account/~/extension/~/presence");
            subscription.AddEvent("/restapi/v1.0/account/~/extension/~/message-store");
            ApiResponse response3 = subscription.Subscribe(Action, Action, Action);

            var wait = Console.ReadLine ();

            Console.WriteLine ("DONE!");
        }
 // Get an authorized SDK instance
 public static SDK NewSDK()
 {
     var appKey = Environment.GetEnvironmentVariable("RC_APP_KEY");
     var appSecret = Environment.GetEnvironmentVariable("RC_APP_SECRET");
     var serverUrl = Environment.GetEnvironmentVariable("RC_APP_SERVER_URL");
     var username = Environment.GetEnvironmentVariable("RC_USER_USERNAME");
     var extension = Environment.GetEnvironmentVariable("RC_USER_EXTENSION");
     var password = Environment.GetEnvironmentVariable("RC_USER_PASSWORD");
     var appName = "Custom Fax Cover Page Text";
     var appVersion = "0.0.1";
     var sdk = new SDK(appKey, appSecret, serverUrl, appName, appVersion);
     sdk.Platform.Login(username, extension, password, true);
     return sdk;
 }
        // Send the fax and return the ApiResponse object
        public static ApiResponse SendFax(SDK sdk)
        {
            // Get Cover Page
            var coverPage = GetCoverPage ();

            // Get Fax Body
            var attachmentBytes = File.ReadAllBytes (Environment.GetEnvironmentVariable ("RC_DEMO_FAX_FILEPATH"));
            var attachment = new Attachment ("example.pdf", "application/pdf", attachmentBytes);

            var attachments = new List<Attachment> {coverPage, attachment};

            var to = Environment.GetEnvironmentVariable ("RC_DEMO_FAX_TO");
            var json = "{\"to\":[{\"phoneNumber\":\"" + to + "\"}],\"coverIndex\":\"0\"}";

            Request request = new Request ("/restapi/v1.0/account/~/extension/~/fax", json, attachments);

            ApiResponse response = sdk.Platform.Post(request);
            return response;
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);

            /* Demo
             *
             * Send SMS and Subscribe
             *
             */
            var appKey = "MyAppKey";
            var appSecret = "MyAppSecret";
            var serverUrl = "https://platform.devtest.ringcentral.com";
            var username = "******";
            var extension = "101";
            var password = "******";

            var sdk = new SDK(appKey, appSecret, serverUrl, "appName", "appVersion");
            ApiResponse response = sdk.Platform.Authorize(username, extension, password, true);

            String jsonSmsString = "{\"from\":{\"phoneNumber\":\"1650111222\"},\"to\":[{\"phoneNumber\":\"+1650111333\"}],\"text\":\"Hello Android\"}";
            Request request = new Request("/restapi/v1.0/account/~/extension/~/sms", jsonSmsString);
            ApiResponse response2 = sdk.Platform.Post(request);

            var subscription = new RingCentral.Subscription.SubscriptionServiceImplementation(){ _platform = sdk.Platform};
            subscription.AddEvent("/restapi/v1.0/account/~/extension/~/presence");
            subscription.AddEvent("/restapi/v1.0/account/~/extension/~/message-store");
            ApiResponse response3 = subscription.Subscribe(Action, Action, Action);

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById<Button> (Resource.Id.myButton);

            button.Click += delegate {
                button.Text = string.Format ("{0} clicks!", count++);
            };
        }