Method: providers.vehicles.search

傳回符合要求選項的車輛清單。

HTTP 要求

POST https://fleetengine.googleapis.com/v1/{parent=providers/*}/vehicles:search

這個網址使用 gRPC 轉碼語法。

路徑參數

參數
parent

string

必要欄位。格式須為 providers/{provider}。提供者必須是 Google Cloud 專案的專案 ID (例如 sample-cloud-project),而此呼叫所屬的服務帳戶必須隸屬於該專案。

要求主體

要求主體的資料會採用以下結構:

JSON 表示法
{
  "header": {
    object (RequestHeader)
  },
  "pickupPoint": {
    object (TerminalLocation)
  },
  "dropoffPoint": {
    object (TerminalLocation)
  },
  "pickupRadiusMeters": integer,
  "count": integer,
  "minimumCapacity": integer,
  "tripTypes": [
    enum (TripType)
  ],
  "maximumStaleness": string,
  "vehicleTypes": [
    {
      object (VehicleType)
    }
  ],
  "requiredAttributes": [
    {
      object (VehicleAttribute)
    }
  ],
  "requiredOneOfAttributes": [
    {
      object (VehicleAttributeList)
    }
  ],
  "requiredOneOfAttributeSets": [
    {
      object (VehicleAttributeList)
    }
  ],
  "orderBy": enum (VehicleMatchOrder),
  "includeBackToBack": boolean,
  "tripId": string,
  "currentTripsPresent": enum (CurrentTripsPresent),
  "filter": string
}
欄位
header

object (RequestHeader)

標準的 Fleet Engine 要求標頭。

pickupPoint

object (TerminalLocation)

必要欄位。要搜尋附近的上車地點。

dropoffPoint

object (TerminalLocation)

消費者指定的下車地點。如果 tripTypes 包含 TripType.SHARED,則此為必要欄位。

pickupRadiusMeters

integer

必要欄位。定義上車地點周圍的車輛搜尋半徑。系統只會傳回搜尋半徑範圍內的車輛。值必須介於 400 到 10000 公尺 (含) 之間。

count

integer

必要欄位。指定要傳回的車輛數量上限。值必須介於 1 到 50 (含) 之間。

minimumCapacity

integer

必要欄位。指定行程考慮的乘客人數。這個值必須大於或等於 1。驅動程式不計入容量值。

tripTypes[]

enum (TripType)

必要欄位。代表提議的行程類型。只能包含一種類型。不允許使用UNKNOWN_TRIP_TYPE。限制搜尋範圍僅限支援該行程類型的車輛。

maximumStaleness

string (Duration format)

限制搜尋範圍,只允許在指定時間範圍內曾傳送位置更新資訊至 Fleet Engine 的車輛。靜態車輛傳輸其所在位置不算是過時。如未設定這個欄位,伺服器會使用 5 分鐘做為預設值。

持續時間以秒為單位,最多 9 個小數位數,結尾為「s」,例如:"3.5s"

vehicleTypes[]

object (VehicleType)

必要欄位。將搜尋範圍限制在具備其中一種指定類型的車輛。至少須指定一個交通工具類型。不允許使用類別為 UNKNOWN 的 VehicleType。

requiredAttributes[]

object (VehicleAttribute)

呼叫端可以使用 requiredAttributesrequiredOneOfAttributesrequiredOneOfAttributeSets 欄位的任意組合來形成複雜的邏輯運算。

requiredAttributes 是清單;requiredOneOfAttributes 會使用允許清單清單的訊息。結合使用兩個欄位時,可組合這個運算式:

(requiredAttributes[0] AND requiredAttributes[1] AND ...)
AND
(requiredOneOfAttributes[0][0] OR requiredOneOfAttributes[0][1] OR
...)
AND
(requiredOneOfAttributes[1][0] OR requiredOneOfAttributes[1][1] OR
...)

將搜尋範圍限制在具備指定屬性的車輛。這個欄位是結合/AND 運算。最多允許 50 個 requiredAttributes。這與車輛允許的屬性數量上限相符。

requiredOneOfAttributes[]

object (VehicleAttributeList)

限制搜尋範圍僅限具備每個 VehicleAttributeList 中至少一項指定屬性的車輛。每份清單中的車輛都必須與至少一項屬性相符。這個欄位是每個 VehicleAttributeList 中的包含式抽離/OR 運算,以及跨 VehicleAttributeList 集合的連接/AND 運算。

requiredOneOfAttributeSets[]

object (VehicleAttributeList)

requiredOneOfAttributeSets 提供額外功能。

requiredOneOfAttributes 類似,requiredOneOfAttributeSets 會使用允許清單清單的訊息,並允許類似下列運算式的運算式:

(requiredAttributes[0] AND requiredAttributes[1] AND ...)
AND
(
  (requiredOneOfAttributeSets[0][0] AND
  requiredOneOfAttributeSets[0][1] AND
  ...)
  OR
  (requiredOneOfAttributeSets[1][0] AND
  requiredOneOfAttributeSets[1][1] AND
  ...)
)

限制只搜尋具有 VehicleAttributeList 中所有屬性的車輛。每份清單內的車輛都必須與所有屬性相符。這個欄位是每個 VehicleAttributeList 的結合/AND 運算,以及涵蓋 VehicleAttributeList 集合的多元包容/OR 運算。

orderBy

enum (VehicleMatchOrder)

必要欄位。指定結果的排序條件。

includeBackToBack

boolean

這表示提供一次有效行程的車輛是否符合這項搜尋的資格。只有在未指定 currentTripsPresent 時,才能使用此欄位。如果未指定 currentTripsPresent 且這個欄位為 false,系統會在搜尋結果中排除具有已指派行程的車輛。如果未指定 currentTripsPresent,且這個欄位為 true,搜尋結果可能包含一個狀態為 ENROUTE_TO_DROPOFF 的有效行程車輛。如果指定 currentTripsPresent,這個欄位無法設為 true。

預設值為 false

tripId

string

指出與這個 SearchVehicleRequest 相關聯的行程。

currentTripsPresent

enum (CurrentTripsPresent)

這表示內含有效行程的車輛是否符合這項搜尋的資格。如果 tripType 包含 SHARED,則這個值必須設為 CURRENT_TRIPS_PRESENT_UNSPECIFIED 以外的項目。

filter

string

選用設定。搜尋車輛時要套用的篩選器查詢。如需篩選器語法的範例,請參閱 http://aip.dev/160

這個欄位的用途是取代 requiredAttributesrequiredOneOfAttributesrequired_one_of_attributes_sets 欄位。如果在此處指定非空白值,下列欄位必須留空:requiredAttributesrequiredOneOfAttributesrequired_one_of_attributes_sets

這個篩選器可當做 AND 子句與其他限制 (例如 minimumCapacityvehicleTypes) 使用。

請注意,只有車輛屬性 (例如 attributes.<key> = <value>attributes.<key1> = <value1> AND attributes.<key2> = <value2>) 支援查詢。篩選器查詢最多可接受 50 項限制。

此外,所有屬性都會儲存為字串,因此唯一支援的比較項目是字串比較。為了與數字或布林值比較,您必須將值明確加上引號,才會視為字串 (例如 attributes.<key> = "10"attributes.<key> = "true")。

回應主體

如果成功,回應主體會包含 SearchVehiclesResponse 的執行例項。