ListVehicles পদ্ধতি ব্যবহার করে এমন সমস্ত যানবাহন খুঁজে বের করা যা কিছু নির্দিষ্ট অনুরোধের বিকল্প পূরণ করে। ListVehicles পদ্ধতিটি প্রকল্পে যানবাহনের একটি পৃষ্ঠাযুক্ত তালিকা প্রদান করে যা যানবাহন ক্ষেত্র জুড়ে প্রশ্নের সাথে মেলে।
গাড়ির বৈশিষ্ট্য অনুসারে ফিল্টার করুন
আপনি এই পদ্ধতিটি যানবাহনের বৈশিষ্ট্যগুলিতে ফিল্টার করার জন্যও ব্যবহার করতে পারেন, যা অন্যান্য ক্ষেত্রের নির্দিষ্টকরণের সাথে একত্রে ব্যবহার করার সময় AND অপারেটর হিসাবে কাজ করে। ফিল্টার ক্যোয়ারী সিনট্যাক্স সম্পর্কে বিস্তারিত জানার জন্য, উদাহরণস্বরূপ ফিল্টারিং: AIP-160 দেখুন। যানবাহনের বৈশিষ্ট্য তৈরি করার বিশদ জানতে, আপডেট যানবাহন ক্ষেত্র নির্দেশিকাতে যানবাহনের বৈশিষ্ট্য ক্ষেত্রটি দেখুন।
গাড়ির উদাহরণ তালিকাভুক্ত করুন
এই উদাহরণটি filter স্ট্রিং ব্যবহার করে vehicle_type এবং attributes উভয় ক্ষেত্রেই ফিল্টার করে, শুধুমাত্র AUTO ধরণের যানবাহন দেখায় এবং class এর কাস্টম অ্যাট্রিবিউটের জন্য LUXURY মান পায়।
জাভা
static final String PROJECT_ID = "project-id";
VehicleServiceBlockingStub vehicleService = VehicleService.newBlockingStub(channel);
String parent = "providers/" + PROJECT_ID;
ListVehiclesRequest listVehiclesRequest = ListVehiclesRequest.newBuilder()
.setParent(parent)
.addTripTypes(TripType.EXCLUSIVE)
.addVehicleTypes(VehicleType.newBuilder().setCategory(VehicleType.Category.AUTO))
.setFilter("attributes.on_trip=\"false\"")
.setIncludeBackToBack(true) // Fleet Engine includes vehicles that are en route.
.build();
// Error handling
// If matches are returned and the authentication passed, the request completed
// successfully
try {
ListVehiclesResponse listVehiclesResponse =
vehicleService.listVehicles(listVehiclesRequest);
} catch (StatusRuntimeException e) {
Status s = e.getStatus();
switch (s.getCode()) {
case NOT_FOUND:
break;
case PERMISSION_DENIED:
break;
}
return;
}
বিশ্রাম
curl -X POST \
"https://fleetengine.googleapis.com/v1/providers/project-id/vehicles:list" \
-H "Authorization: Bearer $JWT" \
-H "Content-Type: application/json" \
--data-binary @- << EOM
{
"vehicleTypes": [{"category": "AUTO"}],
"filter": "attributes.class=\"LUXURY\"",
}
EOM