Exemplo n.º 1
0
        /// <inheritdoc />
        public IEnumerable <CompanyListElement> ListCompanies(ListCompaniesRequest request)
        {
            RestRequest restRequest = getRequest("/listCompanies", request);
            IRestResponse <List <CompanyListElement> > result = this._client.Execute <List <CompanyListElement> >(restRequest);

            return(result.Data);
        }
        /// <summary>Snippet for ListCompaniesAsync</summary>
        public async Task ListCompaniesRequestObjectAsync()
        {
            // Snippet: ListCompaniesAsync(ListCompaniesRequest, CallSettings)
            // Create client
            CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync();

            // Initialize request argument(s)
            ListCompaniesRequest request = new ListCompaniesRequest
            {
                ParentAsTenantName = TenantName.FromProjectTenant("[PROJECT]", "[TENANT]"),
                RequireOpenJobs    = false,
            };
            // Make the request
            PagedAsyncEnumerable <ListCompaniesResponse, Company> response = companyServiceClient.ListCompaniesAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((Company item) =>
            {
                // Do something with each item
                Console.WriteLine(item);
            });

            // Or iterate over pages (of server-defined size), performing one RPC per page
            await response.AsRawResponses().ForEachAsync((ListCompaniesResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Company item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            });

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int            pageSize   = 10;
            Page <Company> singlePage = await response.ReadPageAsync(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (Company item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
        /// <summary>Snippet for ListCompanies</summary>
        public void ListCompanies_RequestObject()
        {
            // Snippet: ListCompanies(ListCompaniesRequest,CallSettings)
            // Create client
            CompanyServiceClient companyServiceClient = CompanyServiceClient.Create();
            // Initialize request argument(s)
            ListCompaniesRequest request = new ListCompaniesRequest
            {
                ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")),
            };
            // Make the request
            PagedEnumerable <ListCompaniesResponse, Company> response =
                companyServiceClient.ListCompanies(request);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (Company item in response)
            {
                // Do something with each item
                Console.WriteLine(item);
            }

            // Or iterate over pages (of server-defined size), performing one RPC per page
            foreach (ListCompaniesResponse page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Company item in page)
                {
                    Console.WriteLine(item);
                }
            }

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int            pageSize   = 10;
            Page <Company> singlePage = response.ReadPage(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (Company item in singlePage)
            {
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
Exemplo n.º 4
0
        // [START job_search_list_companies_beta]
        public static object ListCompanies(string projectId, string tenantId)
        {
            CompanyServiceClient companyServiceClient = CompanyServiceClient.Create();
            TenantName           tenantName           = TenantName.FromProjectTenant(projectId, tenantId);

            ListCompaniesRequest request = new ListCompaniesRequest
            {
                ParentAsTenantName = tenantName
            };
            var companies = companyServiceClient.ListCompanies(request);

            foreach (var company in companies)
            {
                Console.WriteLine($"Company Name: {company.Name}");
                Console.WriteLine($"Display Name: {company.DisplayName}");
                Console.WriteLine($"External ID: {company.ExternalId}");
            }
            return(0);
        }
Exemplo n.º 5
0
        public ListCompaniesResponse ListCompanies(ListCompaniesRequest request)
        {
            ListCompaniesResponse response = new ListCompaniesResponse();
            response.ExceptionState = false;

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

            return response;
        }