Exemple #1
0
 public ChiBotApiClient(IChiBotHttpClientFacotry httpClientFactory)
 {
     _client             = httpClientFactory.CreateClient();
     Personalities       = new PersonalityClient(_client, "Personalities");
     TwitchChannels      = new TwitchChannelClient(_client, "TwitchChannels");
     Quotes              = new QuoteClient(_client, "Quotes");
     PersonalityCommands = new PersonalityCommandClient(_client, "PersonalityCommands");
 }
 static void Main(string[] args)
 {
     using (QuoteClient client = new QuoteClient())
     {
         Console.WriteLine("Press any key when service started ...");
         Console.ReadLine();
         string id    = "quote:2007-07-15";
         Quote  quote = client.GetQuote(id);
         Assert.AreEqual <string>(id, quote.Id);
         Console.WriteLine(quote.Id);
         Console.ReadLine();
     }
 }
Exemple #3
0
        private static async Task SentimentMessage(HttpClient client, string from, LuisData luisData, string searchKeywords)
        {
            string sentimentMessage;

            switch (luisData.SentimentAnalysis.Label)
            {
            case "positive":
                sentimentMessage = $"You seemed happy you should probable calm down and remember a bitcoin is worth £";
                break;

            case "negative":
                sentimentMessage = $"You seemed sad, how bout a chuck norris fact to cheer you up: ";
                break;

            default:
                sentimentMessage = $"We couldn't figure out how you were feeling... here's a quote to inspire you: ";
                break;
            }

            switch (luisData.SentimentAnalysis.Label)
            {
            case "positive":
                var coinClient = new BitcoinClient();
                var coinValue  = await coinClient.GetPrice();

                sentimentMessage = sentimentMessage + coinValue;
                break;

            case "negative":
                var chuckClient = new ChuckClient();
                var joke        = await chuckClient.GetJoke();

                sentimentMessage = sentimentMessage + ": " + joke.value;
                break;

            default:
                var quoteClient = new QuoteClient();
                var quote       = await quoteClient.GetQuote();

                sentimentMessage = sentimentMessage + " " + quote;
                break;
            }

            SendTextMessage(client, from, sentimentMessage);
        }
 public QuotesService()
 {
     _quoteClient = ClientContext.Clients.CreateQuoteClient();
 }
Exemple #5
0
        /// <summary>
        /// Gets the WFM Service Configured based on your requirements
        /// </summary>
        /// <param name="serviceType">The Service Type Required ("Client", "Contact" ...)</param>
        /// <returns>The Service, fully populated</returns>
        public static Object GetWcfSvc(string serviceType)
        {
            Uri             serviceUri;
            EndpointAddress endpointAddress;
            var             binding = BindingFactory.CreateInstance();
            object          service = null;

            string serviceBase = "http://modernpractice2013.cloudapp.net";

            if (DefaultRegion == "NZ")
            {
                serviceBase = "http://modernpractice2013-nz.cloudapp.net";
            }

            //serviceBase = "http://localhost:56019";

            switch (serviceType)
            {
            case "Client":
                serviceUri      = new Uri(serviceBase + "/ClientService.svc");
                endpointAddress = new EndpointAddress(serviceUri);
                service         = new ClientClient(binding, endpointAddress);
                break;

            case "Contact":
                serviceUri      = new Uri(serviceBase + "/ContactService.svc");
                endpointAddress = new EndpointAddress(serviceUri);
                service         = new ContactClient(binding, endpointAddress);
                break;

            case "CustomField":
                serviceUri      = new Uri(serviceBase + "/CustomFieldDefinitionService.svc");
                endpointAddress = new EndpointAddress(serviceUri);
                service         = new CustomFieldDefinitionClient(binding, endpointAddress);
                break;

            case "Invoice":
                serviceUri      = new Uri(serviceBase + "/InvoiceService.svc");
                endpointAddress = new EndpointAddress(serviceUri);
                service         = new InvoiceClient(binding, endpointAddress);
                break;

            case "Job":
                serviceUri      = new Uri(serviceBase + "/JobService.svc");
                endpointAddress = new EndpointAddress(serviceUri);
                service         = new JobClient(binding, endpointAddress);
                break;

            case "Lead":
                serviceUri      = new Uri(serviceBase + "/LeadService.svc");
                endpointAddress = new EndpointAddress(serviceUri);
                service         = new LeadClient(binding, endpointAddress);
                break;

            case "Quote":
                serviceUri      = new Uri(serviceBase + "/QuoteService.svc");
                endpointAddress = new EndpointAddress(serviceUri);
                service         = new QuoteClient(binding, endpointAddress);
                break;

            case "Task":
                serviceUri      = new Uri(serviceBase + "/TaskService.svc");
                endpointAddress = new EndpointAddress(serviceUri);
                service         = new TaskClient(binding, endpointAddress);
                break;

            case "Staff":
                serviceUri      = new Uri(serviceBase + "/StaffService.svc");
                endpointAddress = new EndpointAddress(serviceUri);
                service         = new StaffClient(binding, endpointAddress);
                break;

            case "Template":
                serviceUri      = new Uri(serviceBase + "/TemplateService.svc");
                endpointAddress = new EndpointAddress(serviceUri);
                service         = new TemplateClient(binding, endpointAddress);
                break;

            case "Cost":
                serviceUri      = new Uri(serviceBase + "/CostService.svc");
                endpointAddress = new EndpointAddress(serviceUri);
                service         = new CostClient(binding, endpointAddress);
                break;

            case "Supplier":
                serviceUri      = new Uri(serviceBase + "/SupplierService.svc");
                endpointAddress = new EndpointAddress(serviceUri);
                service         = new SupplierClient(binding, endpointAddress);
                break;

            case "PurchaseOrder":
                serviceUri      = new Uri(serviceBase + "/PurchaseOrderService.svc");
                endpointAddress = new EndpointAddress(serviceUri);
                service         = new PurchaseOrderClient(binding, endpointAddress);
                break;

            case "Time":
                serviceUri      = new Uri(serviceBase + "/TimeService.svc");
                endpointAddress = new EndpointAddress(serviceUri);
                service         = new SupplierClient(binding, endpointAddress);
                break;
            }
            return(service);
        }
 public static QuoteClient CreateQuoteClientWithUri(this CommerceClients source, string serviceUrl)
 {
     var client = new QuoteClient(new Uri(serviceUrl), source.CreateMessageProcessingHandler());
     return client;
 }
        public static QuoteClient CreateQuoteClientWithUri(this CommerceClients source, string serviceUrl)
        {
            var client = new QuoteClient(new Uri(serviceUrl), source.CreateMessageProcessingHandler());

            return(client);
        }