Exemple #1
0
        private static async Task <Models.Client> DeleteClient(Models.Client client, OpenLoggingAccountClient cl)
        {
            Writeline("Deleting Client #" + client.ClientId);
            var res = await cl.DeleteClientAsync(client);

            return(res);
        }
Exemple #2
0
        private static async Task <Models.Client> CreateClient(string uri, OpenLoggingAccountClient cl)
        {
            Writeline("Creating Client...");
            var clientCreationResult = await cl.CreateClientAsync(new SethWebster.OpenLogging.Models.Client()
            {
                ClientName = "Southwest"
            });

            Writeline("Created Client #" + clientCreationResult.ClientId);
            return(clientCreationResult);
        }
Exemple #3
0
        private static async Task <object> ListClients(OpenLoggingAccountClient cl)
        {
            var res = await cl.ListClients();

            Writeline(res.Count() + " clients");
            foreach (var c in res)
            {
                Writeline(c.ClientId + " " + c.ClientName + " " + c.CurrentApiKey);
            }
            return(res);
        }
Exemple #4
0
        static async Task <LogMessage> dostuff()
        {
            // Production URL
            string uri = "http://openlogger.azurewebsites.net/api";

            // "openlogger" hostname used below is so that we can debug with Fidder; this requires
            // updates to the CustomRules of Fiddler.
            // See http://codebetter.com/howarddierking/2011/05/09/getting-fiddler-and-the-net-framework-to-play-better-together-2/ for usage
            // Uncomment this line when using Fiddler (and set up as above)
            uri = "http://openlogger/api/";
            // Uncomment this line when not using Fiddler
            // uri = "http://localhost:60757/api/";

            // This ID must already exist
            Guid accountApiKey = new Guid("90a1de78-cd4d-4b7e-a356-7e6e3fb01be3");
            OpenLoggingAccountClient acctClient = new OpenLoggingAccountClient(accountApiKey, new Uri(uri));

            var client = acctClient.CreateClient(new Models.Client()
            {
                ClientName = "The Test Client"
            });

            OpenLoggingClient logClient = new OpenLoggingClient(client.CurrentApiKey, new Uri(uri));
            var entry = logClient.NewLogEntry(new LogMessage()
            {
                Title       = "The Test Log Entry",
                Message     = "This is the message",
                Category    = "INFO",
                Body        = "This is the extended description",
                DateOfEvent = DateTimeOffset.Now.AddSeconds(-25)
            });

            Writeline("All created. ENTER to Delete"); Readline();
            acctClient.DeleteClient(client);
            return(entry);
        }