0

我正在按照此处列出的示例列出工作: https ://cloud.google.com/talent-solution/job-search/docs/jobs#list_jobs

我收到的错误是:

Status(StatusCode="InvalidArgument", Detail="Invalid filter: count(base_compensation, [bucket(12, 20)])。跟踪请求 ID:d3e16e3c-a103-48eb-8970-1d3f9228e825:APAb7ISxs+hMPVsQYxAL/Pe7jH+FNIlvBA ==", DebugException="Grpc.Core.Internal.CoreErrorDetailException: {"created":"@1619001587.481000000","description":"从对等 ipv4:172.217.170.10:443 收到错误","file":"T: \src\github\grpc\workspace_csharp_ext_windows_x64\src\core\lib\surface\call.cc","file_line":1062,"grpc_message":"无效过滤器:count(base_compensation, [bucket(12, 20)])。跟踪请求 ID:d3e16e3c-a103-48eb-8970-1d3f9228e825:APAb7ISxs+hMPVsQYxAL/Pe7jH+FNIlvBA==","grpc_status":3}")

我对如何创建过滤器进行了进一步研究,然后我尝试使用这篇文章创建自己的位置过滤器: https ://cloud.google.com/talent-solution/job-search/docs/reference/rest/v4/JobQuery #locationfilter

我创建了一个简单的类来表示他们的 Json 对象:

    public class AddressFilter
    {
        public string Address { get; set; }
        public string RegionCode { get; set; }
        public object LatLng { get; set; }
        public decimal DistanceInMiles { get; set; }
        public Google.Cloud.Talent.V4.LocationFilter.Types.TelecommutePreference TelecommutePreference { get; set; }
    }

然后使用 JsonConvert 将我的对象序列化为 Json:

            string filter = JsonConvert.SerializeObject(new AddressFilter()
            {
                Address = "Pretoria",
                RegionCode = "0150",
                LatLng = null,
                TelecommutePreference = Google.Cloud.Talent.V4.LocationFilter.Types.TelecommutePreference.TelecommuteAllowed,
                DistanceInMiles = 500
            });

但我得到了与演示过滤器相同的异常。

这是我用来在 C# 中列出作业的代码:

 public async Task ListJobsAsync(string projectID, string tenantID, string filter)
        {
            try
            {
                var path = '//My Path to application credentials///';
                System.Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", path);

                JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync();

                TenantName parent = new TenantName(projectID, tenantID);

                ListJobsRequest request = new ListJobsRequest();

                request.Parent = parent.ToString();
                request.Filter = filter;

                foreach (Job responseItem in jobServiceClient.ListJobs(request))
                {

                }
            }
            catch (Exception ex)
            {

                throw;
            }
        }

有人可以告诉我我做错了什么吗?

4

0 回答 0