public static string AddServiceProviderAccount(string accessToken) { if (string.IsNullOrEmpty(accessToken)) { Console.WriteLine("The access token cannot be null or empty!"); return(null); } ServicePointManager.ServerCertificateValidationCallback += delegate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return(true); }; ServicePointManager.Expect100Continue = false; userCredentials credentials = new userCredentials() { accessToken = accessToken }; AddServiceProvider request = CreateAddServiceProviderRequest(new Random()); AddServiceProviderResponse response = new AddServiceProviderResponse(); ServiceProviderClient serviceProviderClient = new ServiceProviderClient("ServiceProviderPort"); Console.WriteLine("Adding a Service Provider..."); try { serviceProviderClient.AddServiceProvider(credentials, request, out response); } catch (Exception e) { //exception found, so we check the stack trc String trace = e.StackTrace; //write the stack trace to the console Console.WriteLine("{0} Exception caught.", e); //wait for the user to press a key before closing the console Console.Read(); } finally { Console.WriteLine("The response for adding a Service Provider:"); foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(response)) { string name = descriptor.Name; object value = descriptor.GetValue(response); Console.WriteLine("\t{0}={1}", name, value); } Console.WriteLine(); } return(response.ID); }
public static void SetOrganizationAccountPermissionsAndLimits(string accessToken, string organizationID) { if (string.IsNullOrEmpty(accessToken)) { Console.WriteLine("The access token cannot be null or empty!"); return; } if (string.IsNullOrEmpty(organizationID)) { Console.WriteLine("The organizationID parameter cannot be null or empty!"); return; } ServicePointManager.ServerCertificateValidationCallback += delegate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return(true); }; ServicePointManager.Expect100Continue = false; userCredentials credentials = new userCredentials() { accessToken = accessToken }; SetOrganizationPL request = CreateSetOrganizationPLRequest(organizationID); updateObject response = new updateObject(); OrganizationClient organizationClient = new OrganizationClient("OrganizationPort"); Console.WriteLine("Setting the Permissions and Limits for the Organization with the ID = {0}.", organizationID); try { organizationClient.SetOrganizationPL(credentials, request, out response); } catch (Exception e) { //exception found, so we check the stack trc String trace = e.StackTrace; //write the stack trace to the console Console.WriteLine("{0} Exception caught.", e); //wait for the user to press a key before closing the console Console.Read(); } finally { Console.WriteLine("The operation response:"); foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(response)) { string name = descriptor.Name; object value = descriptor.GetValue(response); Console.WriteLine("\t{0}={1}", name, value); } Console.WriteLine(); } }
public static void GetCallCosts(string accessToken, string userID) { if (string.IsNullOrEmpty(userID)) { Console.WriteLine("The userID parameter cannot be null or empty"); return; } if (string.IsNullOrEmpty(accessToken)) { Console.WriteLine("The access token cannot be null or empty!"); return; } ServicePointManager.ServerCertificateValidationCallback += delegate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return(true); }; ServicePointManager.Expect100Continue = false; userCredentials credentials = new userCredentials() { accessToken = accessToken }; CallCosts request = CreateCallCostsRequest(userID); CallCostsResponse response = new CallCostsResponse(); ReportClient reportClient = new ReportClient("ReportPort"); Console.WriteLine("Getting the call costs for the user with the id = {0}", userID); try { reportClient.CallCosts(credentials, request, out response); } catch (Exception e) { //exception found, so we check the stack trc String trace = e.StackTrace; //write the stack trace to the console Console.WriteLine("{0} Exception caught.", e); //wait for the user to press a key before closing the console Console.Read(); } finally { Console.WriteLine("The operation response:"); foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(response)) { string name = descriptor.Name; object value = descriptor.GetValue(response); Console.WriteLine("\t{0}={1}", name, value); } Console.WriteLine(); } }
public async Task sendUserCredentials(userCredentials userCredentials) { await fbClient.Child("userCredentials").PostAsync <userCredentials>(userCredentials); }
public static void AddExtensionAccount(string accessToken, string parentUserID) { if (string.IsNullOrEmpty(parentUserID)) { Console.WriteLine("The parentUserID parameter cannot be null or empty"); return; } if (string.IsNullOrEmpty(accessToken)) { Console.WriteLine("The access token cannot be null or empty!"); return; } ServicePointManager.ServerCertificateValidationCallback += delegate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return(true); }; ServicePointManager.Expect100Continue = false; userCredentials credentials = new userCredentials() { accessToken = accessToken }; AddExtension request = CreateExtensionRequest(new Random(), parentUserID); AddExtensionResponse response = new AddExtensionResponse(); ExtensionClient extension = new ExtensionClient("ExtensionPort"); Console.WriteLine("Adding the Extension with the label = {0}.", request.label); try { extension.AddExtension(credentials, request, out response); } catch (Exception e) { //exception found, so we check the stack trc String trace = e.StackTrace; //write the stack trace to the console Console.WriteLine("{0} Exception caught.", e); //wait for the user to press a key before closing the console Console.Read(); } finally { Console.WriteLine("The operation response:"); foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(response)) { string name = descriptor.Name; object value = descriptor.GetValue(response); Console.WriteLine("\t{0}={1}", name, value); } Console.WriteLine(); } }