Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            // Authorize the client using Application Default Credentials.
            // See: https://developers.google.com/identity/protocols/application-default-credentials
            GoogleCredential credential = GoogleCredential.GetApplicationDefaultAsync().Result;

            // Specify the Service scope.
            if (credential.IsCreateScopedRequired)
            {
                credential = credential.CreateScoped(new[]
                {
                    Google.Apis.JobService.v2.JobServiceService.Scope.Jobs
                });
            }
            // Instantiate the Cloud Key Management Service API.
            JobServiceService jobServiceClient = new JobServiceService(new BaseClientService.Initializer
            {
                HttpClientInitializer = credential,
                GZipEnabled           = false
            });

            // List companies.
            ListCompaniesResponse result = jobServiceClient.Companies.List().Execute();

            Console.WriteLine("Request Id: " + result.Metadata.RequestId);
            if (result.Companies != null)
            {
                Console.WriteLine("Companies: ");
                result.Companies.ToList().ForEach(company => Console.WriteLine(company.Name));
            }
            else
            {
                Console.WriteLine("No companies found.");
            }
        }
Exemplo n.º 2
0
        public ListCompaniesResponse ListCompanies(ListCompaniesRequest request)
        {
            ListCompaniesResponse response = new ListCompaniesResponse();
            response.ExceptionState = false;

            response.Companies = _companyRepository.FindAll().ConvertToCompanySummaryView();

            return response;
        }