示例#1
0
        // [END custom_attribute_filter_long_value]

        // [START custom_attribute_filter_multi_attributes

        public static void FiltersOnMultiCustomAttributes()
        {
            RequestMetadata requestMetadata = new RequestMetadata()
            {
                UserId    = "HashedUserId",
                SessionId = "HashedSessionId",
                Domain    = "www.google.com"
            };

            string customAttributeFilter = "(someFiledName1 = \"value1\") " +
                                           "AND ((255 <= someFieldName2) OR (someFieldName2 <= 213))";
            JobQuery jobQuery = new JobQuery()
            {
                CustomAttributeFilter = customAttributeFilter
            };

            SearchJobsRequest searchJobsRequest = new SearchJobsRequest()
            {
                JobQuery        = jobQuery,
                RequestMetadata = requestMetadata,
                JobView         = "JOB_VIEW_FULL"
            };

            SearchJobsResponse response = jobServiceClient.Projects.Jobs.Search(searchJobsRequest, parent).Execute();

            Console.WriteLine("Searched on cross-field-filtering: " + ToJsonString(response));
        }
示例#2
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            SearchJobsResponse response = new SearchJobsResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("jobs", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <JobSummary, JobSummaryUnmarshaller>(JobSummaryUnmarshaller.Instance);
                    response.Jobs = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("nextToken", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.NextToken = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
示例#3
0
        // [END custom_attribute_job

        // [START custom_attribute_filter_string_value]

        public static void FiltersOnStringValueCustomAttribute()
        {
            RequestMetadata requestMetadata = new RequestMetadata()
            {
                UserId    = "HashedUserId",
                SessionId = "HashedSessionId",
                Domain    = "www.google.com"
            };

            string   customAttributeFilter = "NOT EMPTY(custom_attribute)";
            JobQuery jobQuery = new JobQuery()
            {
                CustomAttributeFilter = customAttributeFilter
            };

            SearchJobsRequest searchJobsRequest = new SearchJobsRequest()
            {
                JobQuery        = jobQuery,
                RequestMetadata = requestMetadata,
                JobView         = "JOB_VIEW_FULL"
            };

            SearchJobsResponse response = jobServiceClient.Projects.Jobs.Search(searchJobsRequest, parent).Execute();

            Console.WriteLine("Searched on custom attribute: " + ToJsonString(response));
        }
示例#4
0
        // [END compensation_filter]

        public static void BasicSearchJobs(string companyName, string query)
        {
            RequestMetadata requestMetadata = new RequestMetadata()
            {
                // Make sure to hash your userID
                UserId = "HashedUserId",
                // Make sure to hash the sessionID
                SessionId = "HashedSessionId",
                // Domain of the website where the search is conducted
                Domain = "www.google.com"
            };

            JobQuery jobQuery = new JobQuery()
            {
                Query        = query,
                CompanyNames = new List <string>
                {
                    companyName
                }
            };

            SearchJobsRequest searchJobRequest = new SearchJobsRequest()
            {
                RequestMetadata = requestMetadata,
                JobQuery        = jobQuery,
                SearchMode      = "JOB_SEARCH"
            };

            SearchJobsResponse searchJobsResponse = jobServiceClient.Projects.Jobs.Search(searchJobRequest, parent).Execute();

            Console.WriteLine("Jobs searched: " + ToJsonString(searchJobsResponse));
        }
示例#5
0
        // [END company_display_name_filter]

        // [START compensation_filter]

        public static void CompensationSearch(string companyName)
        {
            RequestMetadata requestMetadata = new RequestMetadata()
            {
                // Make sure to hash your userID
                UserId = "HashedUserId",
                // Make sure to hash the sessionID
                SessionId = "HashedSessionId",
                // Domain of the website where the search is conducted
                Domain = "www.google.com"
            };

            JobQuery jobQuery = new JobQuery()
            {
                CompensationFilter = new CompensationFilter()
                {
                    Type  = "UNIT_AND_AMOUNT",
                    Units = new List <string> {
                        "HOURLY"
                    },
                    Range = new CompensationRange()
                    {
                        MaxCompensation = new Money()
                        {
                            CurrencyCode = "USD",
                            Units        = 15L
                        },
                        MinCompensation = new Money()
                        {
                            CurrencyCode = "USD",
                            Units        = 10L,
                            Nanos        = 500000000
                        }
                    }
                }
            };

            if (companyName != null)
            {
                jobQuery.CompanyNames = new List <string>
                {
                    companyName
                };
            }

            SearchJobsRequest searchJobRequest = new SearchJobsRequest()
            {
                RequestMetadata = requestMetadata,
                JobQuery        = jobQuery,
                SearchMode      = "JOB_SEARCH"
            };

            SearchJobsResponse searchJobsResponse = jobServiceClient.Projects.Jobs.Search(searchJobRequest, parent).Execute();

            Console.WriteLine("Jobs compensation searched: " + ToJsonString(searchJobsResponse));
        }
示例#6
0
        // [END city_location_search]

        // [START multi_location_search]

        public static void MultiLocationSearch(string companyName, string location1, double distance1, string location2)
        {
            RequestMetadata requestMetadata = new RequestMetadata()
            {
                // Make sure to hash your userID
                UserId = "HashedUserId",
                // Make sure to hash the sessionID
                SessionId = "HashedSessionId",
                // Domain of the website where the search is conducted
                Domain = "www.google.com"
            };

            LocationFilter locationFilter1 = new LocationFilter()
            {
                Address         = location1,
                DistanceInMiles = distance1
            };

            LocationFilter locationFilter2 = new LocationFilter()
            {
                Address = location2
            };

            JobQuery jobQuery = new JobQuery()
            {
                LocationFilters = new List <LocationFilter>()
                {
                    locationFilter1,
                    locationFilter2
                }
            };

            if (companyName != null)
            {
                jobQuery.CompanyNames = new List <string>
                {
                    companyName
                };
            }

            SearchJobsRequest searchJobRequest = new SearchJobsRequest()
            {
                RequestMetadata = requestMetadata,
                JobQuery        = jobQuery,
                SearchMode      = "JOB_SEARCH"
            };

            SearchJobsResponse searchJobsResponse = jobServiceClient.Projects.Jobs.Search(searchJobRequest, parent).Execute();

            Console.WriteLine("Jobs multi location searched: " + ToJsonString(searchJobsResponse));
        }
示例#7
0
        // [START histogram_search]

        public static void HistogramSearch(String companyName)
        {
            RequestMetadata requestMetadata = new RequestMetadata()
            {
                // Make sure to hash your userID
                UserId = "HashedUserId",
                // Make sure to hash the sessionID
                SessionId = "HashedSessionId",
                // Domain of the website where the search is conducted
                Domain = "www.google.com"
            };

            HistogramFacets histogramFacets = new HistogramFacets()
            {
                SimpleHistogramFacets = new List <String>
                {
                    "COMPANY_ID"
                },
                CustomAttributeHistogramFacets = new List <CustomAttributeHistogramRequest>
                {
                    new CustomAttributeHistogramRequest()
                    {
                        Key = "someFieldName1",
                        StringValueHistogram = true
                    }
                }
            };

            SearchJobsRequest searchJobsRequest = new SearchJobsRequest()
            {
                RequestMetadata = requestMetadata,
                SearchMode      = "JOB_SEARCH",
                HistogramFacets = histogramFacets
            };

            if (companyName != null)
            {
                searchJobsRequest.JobQuery = new JobQuery()
                {
                    CompanyNames = new List <string>
                    {
                        companyName
                    }
                };
            }

            SearchJobsResponse searchJobsResponse = jobServiceClient.Projects.Jobs.Search(searchJobsRequest, parent).Execute();

            Console.WriteLine("Histogram search: " + ToJsonString(searchJobsResponse));
        }
示例#8
0
        // [START commute_search]

        public static void CommuteSearch(string companyName)
        {
            RequestMetadata requestMetadata = new RequestMetadata()
            {
                // Make sure to hash your userID
                UserId = "HashedUserId",
                // Make sure to hash the sessionID
                SessionId = "HashedSessionId",
                // Domain of the website where the search is conducted
                Domain = "www.google.com"
            };

            JobQuery jobQuery = new JobQuery()
            {
                CommuteFilter = new CommuteFilter()
                {
                    RoadTraffic      = "TRAFFIC_FREE",
                    CommuteMethod    = "TRANSIT",
                    TravelDuration   = "1000s",
                    StartCoordinates = new LatLng()
                    {
                        Latitude  = 37.42208,
                        Longitude = -122.085609
                    }
                }
            };

            if (companyName != null)
            {
                jobQuery.CompanyNames = new List <string>
                {
                    companyName
                };
            }

            SearchJobsRequest searchJobRequest = new SearchJobsRequest()
            {
                RequestMetadata          = requestMetadata,
                JobQuery                 = jobQuery,
                JobView                  = "JOB_VIEW_FULL",
                RequirePreciseResultSize = true
            };

            SearchJobsResponse searchJobsResponse = jobServiceClient.Projects.Jobs.Search(searchJobRequest, parent).Execute();

            Console.WriteLine("Jobs commute searched: " + ToJsonString(searchJobsResponse));
        }
示例#9
0
        // [END employment_types_filter

        // [START date_range_filter]

        public static void DateRangeSearch(string companyName, string startTime, string endTime)
        {
            RequestMetadata requestMetadata = new RequestMetadata()
            {
                // Make sure to hash your userID
                UserId = "HashedUserId",
                // Make sure to hash the sessionID
                SessionId = "HashedSessionId",
                // Domain of the website where the search is conducted
                Domain = "www.google.com"
            };

            TimestampRange timeStampRange = new TimestampRange()
            {
                StartTime = startTime,
                EndTime   = endTime
            };

            JobQuery jobQuery = new JobQuery()
            {
                PublishTimeRange = timeStampRange
            };

            if (companyName != null)
            {
                jobQuery.CompanyNames = new List <string>
                {
                    companyName
                };
            }

            SearchJobsRequest searchJobRequest = new SearchJobsRequest()
            {
                RequestMetadata = requestMetadata,
                JobQuery        = jobQuery,
                SearchMode      = "JOB_SEARCH"
            };

            SearchJobsResponse searchJobsResponse = jobServiceClient.Projects.Jobs.Search(searchJobRequest, parent).Execute();

            Console.WriteLine("Jobs date range searched: " + ToJsonString(searchJobsResponse));
        }
示例#10
0
        // [END featured_job]

        // [START search_featured_job]

        public static void SearchFeaturedJobs(string companyName)
        {
            RequestMetadata requestMetadata = new RequestMetadata()
            {
                // Make sure to hash your userID
                UserId = "HashedUserId",
                // Make sure to hash the sessionID
                SessionId = "HashedSessionId",
                // Domain of the website where the search is conducted
                Domain = "www.google.com"
            };

            JobQuery jobQuery = new JobQuery()
            {
                Query = "Software Engineer"
            };

            if (companyName != null)
            {
                jobQuery.CompanyNames = new List <string>
                {
                    companyName
                };
            }

            SearchJobsRequest searchJobRequest = new SearchJobsRequest()
            {
                RequestMetadata = requestMetadata,
                JobQuery        = jobQuery,
                SearchMode      = "FEATURED_JOB_SEARCH"
            };

            SearchJobsResponse searchJobsResponse = jobServiceClient.Projects.Jobs.Search(searchJobRequest, parent).Execute();

            Console.WriteLine("Featured jobs searched: " + ToJsonString(searchJobsResponse));
        }
示例#11
0
        // [START job_search_commute_search]
        public static object CommuteSearchJobs(string projectId, string tenantId)
        {
            JobServiceClient jobServiceClient = JobServiceClient.Create();
            TenantName       name             = TenantName.FromProjectTenant(projectId, tenantId);

            string          domain          = "www.example.com";
            string          sessionId       = "Hashed session identifier";
            string          userId          = "Hashed user identifier";
            RequestMetadata requestMetadata = new RequestMetadata
            {
                Domain    = domain,
                SessionId = sessionId,
                UserId    = userId
            };

            CommuteMethod commuteMethod  = CommuteMethod.Driving;
            long          seconds        = 3600L;
            Duration      travelDuration = new Duration
            {
                Seconds = seconds
            };

            double latitude         = 37.422408;
            double longitude        = -122.084068;
            LatLng startCoordinates = new LatLng
            {
                Latitude  = latitude,
                Longitude = longitude
            };

            CommuteFilter commuteFilter = new CommuteFilter
            {
                CommuteMethod    = commuteMethod,
                TravelDuration   = travelDuration,
                StartCoordinates = startCoordinates
            };

            JobQuery jobQuery = new JobQuery
            {
                CommuteFilter = commuteFilter
            };

            SearchJobsRequest request = new SearchJobsRequest
            {
                ParentAsTenantName = name,
                RequestMetadata    = requestMetadata,
                JobQuery           = jobQuery
            };

            SearchJobsResponse response = jobServiceClient.SearchJobs(request);

            foreach (var result in response.MatchingJobs)
            {
                Console.WriteLine($"Job summary: {result.JobSummary}");
                Console.WriteLine($"Job title snippet: {result.JobTitleSnippet}");
                Job job = result.Job;
                Console.WriteLine($"Job name: {job.Name}");
                Console.WriteLine($"Job title: {job.Title}");
            }

            return(0);
        }