Skip to content

Instantly share code, notes, and snippets.

@janaks09
janaks09 / Program.cs
Created November 24, 2023 05:52
Sample code to perform call out function using ring central c# sdk
var restClient = new RestClient(clientId, clientSecret, true);
await restClient.Authorize(jwtToken);
var parameters = new MakeCallOutRequest
{
from = new MakeCallOutCallerInfoRequestFrom { deviceId = deviceId },
to = new MakeCallOutCallerInfoRequestTo { phoneNumber = phoneToCall }
};
var resp = await restClient.Restapi().Account().Telephony().CallOut().Post(parameters);
@janaks09
janaks09 / ObjectComparer.cs
Last active October 11, 2018 23:50
Compare objects in c#
public static class ObjectComparer
{
public static string GetChangedValues(object oldObject, object newObject)
{
var oType = oldObject.GetType();
var sb = new StringBuilder();
foreach (var oProperty in oType.GetProperties())
{
if (oProperty.Name.ToLower().Equals("lastupdated"))
@janaks09
janaks09 / CreateAzureSqlDatabase.cs
Last active October 9, 2018 01:28
Create Azure SQL database programmatically using Azure SDK for .NET
//Add required namespaces
public class AzureTokenService
{
public static AzureCredentials GetAzureCredentials()
{
var subscriptionId = "SUBSCRIPTION_ID";
var appId = "APP_ID";
var appSecret = "APP_SECRET";
var tenantId = "TENANT_ID";