1

I was trying to use google speech to text API and i read about the NuGet Google APIs packages that can be helpful in speech recognition. Here is the link complete package my code based on documentation provide on https://developers.google.com/api-client-library/dotnet/get_started

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Google.Apis.CloudSpeechAPI.v1beta1.Data;
using Google.Apis.CloudSpeechAPI.v1beta1;
using Google.Apis.Services;

namespace ConsoleApplication2
{
class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine("Cloud Speech Api");
        try
        {
            new Program().Run().Wait();
        }
        catch(AggregateException ex)
        {
            foreach (var e in ex.InnerExceptions)
            {
                Console.WriteLine("Error: "+ e.Message);
            }
        }
        Console.WriteLine("Press any key to continue");
        Console.ReadKey();
    }

    private async Task Run()
    {
        var service = new CloudSpeechAPIService(new BaseClientService.Initializer
        {
            ApplicationName ="Speech Recognition",
            ApiKey="Api key",
        });

        Console.WriteLine("Executing a list request...");
        var result = await service.Apis.List().ExecuteAsync();

        if (result.Items != null)
        {
            foreach (DirectoryList.ItemsData api in result.Items)
            {
                Console.WriteLine(api.Id + " - " + api.Title);
            }
        }

    }
}
}

code is showing error in line

var result = await service.Apis.List().ExecuteAsync(); //Error:'APIS ' definition not exist

also i am not sure that code is correct. please help

DIGIT
  • 79
  • 2
  • 11
  • 1
    Have you taken a look at https://developers.google.com/api-client-library/dotnet/get_started?. This might also help you http://stackoverflow.com/questions/25148373/how-to-use-google-speech-recognition-api-in-c – cstopher Nov 14 '16 at 21:07
  • @ cstopher i checked the documentation and write some code of my own and edited the question please check – DIGIT Jan 15 '17 at 21:17

0 Answers0