GAPI 客户端库

对于服务器到服务器(可信)的通信,我们建议使用 特定语言的 GAPI 客户端库, 使用原始 REST 或 gRPC 协议这些客户端所依据的 protobuf 文件包括 可公开获取 https://github.com/googleapis/googleapis/tree/master/google/maps/fleetengine/delivery/v1.

如果库没有以应用的语言提供,我们建议使用 gRPC 或 Fleet Engine REST 端点。

注意:GAPIC 库适合在受信任的(服务器)环境中运行。 JWT 并非必需。使用应用默认凭据以及 适当的 deliveryAdmin 角色。

Java

Java 库在 google.maps.fleetengine.delivery.v1 下发布。

Gradle

plugins {
  id "maven-publish"
  id "com.google.cloud.artifactregistry.gradle-plugin" version "2.1.4"
}

publishing {
  repositories {
    maven {
      url "artifactregistry://us-maven.pkg.dev/fleetengine-gapic/maven"
    }
  }
}

repositories {
  maven {
    url "artifactregistry://us-maven.pkg.dev/fleetengine-gapic/maven"
  }
}

dependencies {
  implementation 'com.google.maps:gapic-google-maps-fleetengine-delivery-v1-java:latest.release'
}

Maven

<project>
  <distributionManagement>
    <snapshotRepository>
      <id>artifact-registry</id>
      <url>artifactregistry://us-maven.pkg.dev/fleetengine-gapic/maven</url>
    </snapshotRepository>
    <repository>
      <id>artifact-registry</id>
      <url>artifactregistry://us-maven.pkg.dev/fleetengine-gapic/maven</url>
    </repository>
  </distributionManagement>

  <repositories>
    <repository>
      <id>artifact-registry</id>
      <url>artifactregistry://us-maven.pkg.dev/fleetengine-gapic/maven</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

  <build>
    <extensions>
      <extension>
        <groupId>com.google.cloud.artifactregistry</groupId>
        <artifactId>artifactregistry-maven-wagon</artifactId>
        <version>2.1.4</version>
      </extension>
    </extensions>
  </build>

  <dependency>
    <groupId>com.google.maps</groupId>
    <artifactId>gapic-google-maps-fleetengine-delivery-v1-java</artifactId>
    <version>LATEST</version>
  </dependency>
</project>

您可以使用适用于 Java 的 Fleet Engine Auth 库 在 Java 环境中创建已签名的 JSON Web 令牌。

您可以在以下位置查看与 Fleet Engine API 交互的 Java 示例: Fleet Engine 使用入门 页面。

Node.js / TypeScript

请参阅 https://www.npmjs.com/package/@googlemaps/fleetengine-delivery

npm

npm install @googlemaps/fleetengine-delivery

Go

Go 库已打包为一个模块,位于 https://pkg.go.dev/cloud.google.com/go/maps

Python

请参阅 https://pypi.org/project/google-maps-fleetengine-delivery/0.1.0/

pip

pip install google-auth
pip install google-maps-fleetengine-delivery

C#

有关 C# 库的安装说明,请访问 https://www.nuget.org/packages/Google.Maps.FleetEngine.Delivery.V1.

PHP

请参阅 https://packagist.org/packages/google/maps-fleetengine-delivery

Ruby

请参阅 https://rubygems.org/gems/google-maps-fleet_engine-delivery